#help-development
1 messages Ā· Page 1656 of 1
if (event.getEntity() instanceof Ageable) {Ageable ageable = (Ageable) event.getEntity()}
If I were you I'd write down everything you want the plugin to do, then break that down into smaller chunks
And then ageable.isAdult() will work
well my question is would it PersistentDataContainer be better
or would it make more load
on server
is it just better to grab info about item from config
That all depends on how exactly you want it to work. If you GUI is not persistant then using PDC would be no good
well it changes
a lot placeholders
and other stuff
items shuffel
and a lot of crape is happenig
in background
I was just thinking about PersistentDataContainer
as an option
@wary harness please help me
but ok thanks for info
some kind of memory database is probably better
as your UI is not a real inventory theres no need for PDC
for now I have like ItemData class
which has all vairables in it and they get loaded
on server start
Thanks you got beer on my count when we meetšŗ š
High, how is the ping updated and how often ? And is it possible to improve it ? (better refresh)
I'm meaning this one : ((org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) p).getHandle().ping;
OO
BUT WHY CANT IT BE OVER 1?
https://paste.md-5.net/asiwaliquq.java
Why is Condition 'players.size() > 1' is always 'true'
and Condition 'players.isEmpty()' is always 'false' ??
pls help
if im "including myself" then why is it always over 1
@tame coral e
Debug it dude
It can't be empty if it's looping a value
Yeah but
if im "including myself" then why is it always over 1
my man, just as a heads up you are adding yourself multiple times to the players list
like
NVM
what
it was becuz i had 'break;'
i used intellIj find cause thingy
For each world youre adding each player on the server
can i ask a weird java question if u dont mind
if(players.size() > 1){
players.stream().forEach(hosts -> {
pl.sendMessage("&6p" + hosts);
});
pl.sendMessage("&3are your hosts");
}
You will have more than one of each player
it is ^
What are you trying to do
im trying to make it better
i want to
get players from all the server which have
the permission 'eventcore.iamhost'
and broadcast their name to all players in the commandsender world
if its 1 then do a specific message
I would just use a normal loop if you aren't familiar with streams
yes im not lol
You are
anyways anyone that can help me achievve my goal
wut
Loop over all players, if they have the permission add their name to a list, then broadcast the list, then check the list size to see how many hosts there are
So what's the issue
idk it feels like my thing sucks
i just wanted to add glowing items
holy fuck bro
ur internet
i mean
ur pc
is a fucking war machine wtf
there
Just add an enchantment and then give the item the hide enchants flag
gtx1650
i dont want to
Well I don't think spigot supports adding invalid enchantments with the API
You probably need NMS for that
it is too late for my head
actually i dont want invalid enchantments
let me explain
i want to add glow to items
in 1.8, i can simply add the nbt tag ench
with an enpty list
but it seems not to work in 1.16
but
i can add invalid enchantments
when i try this in the spigot server
it doesnt work
does World#getChunk use chunk coordinates or block coordinates?
actually i can add any shit in the enchantments tag
Depends on which one
Anyway use javadoc
sorry meant getChunkAt
?>paste
the javadoc just said coordinates
?paste
The one with two ints are chunk coords iirc
ah ok thanks (:
A quick bitshift will get the right coords for you
I actually already had chunk coords
Aight
if someone knows how to make glowing items without enchanting them i would appreciate
HideFlag and enchant is the only option
Or manually editing the NBT to add something into the enchantment array
Assuming spigot doesn't try and correct invalid data
It might
yes
i think this is the problem now
any way to block the spigot correction?
Make a custom jar without that patch
wait is their a template for a gui? since im trying to find or make a plugin that can put items in someones inventory when they join and it has commands added to it
There are various GUI APIs out there
is possible to give a fake item using packets?
i will give a real stick for example
but i want that the client see that as a stone
example ^
Why would you want to do that?
probably the unix timestamp of the expiration date
might be in millis
it's a date object lol, not a numeric value
Pls elaborate. If you cant give the real ItemStack a glow then you also cant give the packet ItemStack a glow.
@lost matrix
i can if i do what everyone said
sigh
And what would that be?
ill add a random enchantment to the fake item and give the hide flag too
how can I make sure that when taking an object in 2 hands, it is used only in 1?
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
but in server-side the item wont have the enchantment and the flag
Ah i see. Then you should fetch outgoing packets and modify them before they are sent to the client.
hmmmmmm
The interact event is fired twice. Once for the main hand and once for the offhand. If you only want to handle one
of those two packets then you need to differentiate by using the EquipmentSlot with PlayerInteractEvent#getHand() and check if it is
the EquipmentSlot of your choice.
Just add a PDC to the ItemStack and modify the ItemStack based on the PDCs content.
can I please give an example?
pdc?
PersistentDataContainer
a
What version are you on?
1.16
yea
@EventHandler
public void onInteract(final PlayerInteractEvent event) {
final EquipmentSlot eventSlot = event.getHand();
if (eventSlot == EquipmentSlot.OFF_HAND) {
// This code is only run in the off hand event
} else {
// This code is only run in the main hand event
}
}
lul
lul
thank you very much
Is there a rest api to retrieve downloads for a specific plugin?
Hm. There are only scraping approaches as far as i know. This one for example:
https://github.com/Maxlego08/Spigot-WEB-API
Oh and this:
Ah sick thanks
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String [] args) {
if(sender instanceof Player) {
//if(command.getName().equalsIgnoreCase("send")) {
if (label.equalsIgnoreCase("send")) {
sender.sendMessage(ChatColor.GREEN + "Mensagem enviada");
}
return false;
}
}
Unhandled exception executing command 'send' in plugin
anyone knows why get this erro? i just started learning today
?paste
or
ok
im using this
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
i“m portuguese so i don“t know much english but thx
There is nothing that could throw an exception in your code.
hm i don,t know but the error keeps going
Show the error pls
This method must return a result of type boolean
How did you compile this in the first place?
eclipse ide
When your code is red and your IDE yells at you then its time to fix your code instead of force compiling it and hoping for the best.
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String [] args) {
if (sender instanceof Player) {
if (label.equalsIgnoreCase("send")) {
sender.sendMessage(ChatColor.GREEN + "Mensagem enviada");
}
return false;
}
}
as you can see, its borked
fix your indentation and you'll find fixing things comes easier
the method must still return a boolean when the sender is not an instance of Player
Ctrl + A, Ctrl + I (or Ctrl + Shift + F). Best key combination(s) in Eclipse for beginners
That alongside Ctrl + Shift + O for import organization
or just Ctrl + C, Ctrl + V
thx i don“t understand much english but thx

plugin aldeary running
https://paste.md-5.net/aqigogenaf.java why does it just tp the player to bedrock
help pls
i checked config, its
deathrally:
x: -7.0
y: 70.0
z: 355.0
double x = getConfig().getDouble("deathrally.x");
double y = getConfig().getDouble("deathrally.u");
double z = getConfig().getDouble("deathrally.z");
tell me what the problem is
examine this, and you tell me why it does that
yes ik theres smth with4
.u
WAIT
FUCK
I thought y: is u too
ok
thank u
im a fucking bozo
lol it happens
i might as well go commit suicide im useless
com/nik/plugin/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
how do I fix this
upgrade java
what version?
Youve compiled your code on a higher version than the runtime that the server is running on supports
52 is java 8
60 is java 16
i.e. youre running your server with java8
but the plugin requires java16
latest from java's website
nope
itās not
as konica said
you are running it with java 8
type
java -version
in the cmd prompt
1.8.0
what website should I get it from
?java16
Install Java 16 at https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
hello
ty
how do i replace the entity in the PacketPlayOutSpawnEntity
im using protocollib
?paste
how would i do this for entities
I installed it, ran java -version and its still 1.8.0
You want to replace the material or the entity ?
i think is the material
any thing related to the item entity
like, add enchantments
You don't have to do this with packets
but i need this client-side only
Unless you want it to be different for each client
Oh okay
How i check if the args[0] is a player name?
declaration: package: org.bukkit, class: Bukkit
Are you sure you want to use Spawn entity ?
because items aren't spawned
They are thrown by players/entities
Or summoned through commands but that's something else
try and look, i'm searching
https://wiki.vg/Protocol
but i want anything that changes the dropped/spawned item client-side only
Yeah
Oh my bad, it's actually spawn entity
So check if it's an item (id 41)
Then i'll leave you to it, from now here you should be able to figure it out @golden turret
ok thank you
You might want to use packetwrapper
how do player attributes work
like what is generic_attack_damage
what is it's default value
and how does it increase
Is scheduleSyncDelayedTask sync?
@opal juniper I installed it but I did java -version in cmd and it still showed 1.8
nvm
Yay its fixed
does anyone happen to have a handy stacktrace creator utility method just lying around there just so I don't have to write one myself?
how come its underlined?
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(cmd.getName().equals("hello")) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(ChatColor.DARK_RED + "Hello" + ChatColor.DARK_GREEN + player.getName() + "! Your health has been healed.");
player.setHealth(20.0);
} else {
System.out.println("You cannot use this command through console!");
}
}
return false;
}
how come when I run !hello nothing appears?
can someone help me, i made a spawn area with world guard and i cant run any commands anymore without operator
Make yourself operator again?
but its not just me, i made npcs that run commands, and noone can run them
Remove the plugins that are giving problems and start over
is there a way to get a world "in sync" again with its region files, or something like that? i mean: If you delete a region file, everything works normally, you can still build in that region, but its never saved to disk again, and when you restart the server, everything will be lost in that region. is there any way to make the server believe that those chunks arent generated yet, as it does after restarting the server and seeing that those files dont exist?
maybe a method like the deprecated World#regenerateChunk, but that instead of regenerating it, it just "marks" it as not generated, so that when its loaded the next time, its generated and saved to disk, or something like that
Nope
Dam
Only solution is to hide enchantments and apply lore for all the enchantments
minecraft commands start with a /
I meant to say /hello
I've used the following code to freeze a player ā¤µļø but would like to reset it soon after. Does anyone know the default values?java player.setFlySpeed(0); player.setWalkSpeed(0);
is there a player.getFlySpeed()?
if so, then you can just store the old speed and then set it to the stored speed when resetting
there is but say the player was already affected and I may be new to plugins and have no idea how to fix it.
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(cmd.getName().equals("hello")) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(ChatColor.DARK_RED + "Hello" + ChatColor.DARK_GREEN + player.getName() + "! Your health has been healed.");
player.setHealth(20.0);
} else {
System.out.println("You cannot use this command through console!");
}
}
return false;
}
how come when I run /hello nothing appears?
it's the "label" parameter not the "cmd"
the way i use it would be label.equals("hello")
no. cmd.getName() is the preferred way
otherwise you have to compare the label against every single alias
though even then, you don't have to check that if you set an executor
if your command isn't running, you haven't registered it in the plugin.yml or set the executor if it's in a class outside of your javaplugin class
main: com.nik.niksplugin.Main
name: NiksPlugin
description: Nik's First Plugin
version: 1.0
commands:
hello:
aliases: [hi, sup]
description: Says Hello and heals you.
thats my plugin.yml
Unrelated note, don't assume that the player's max health is 20.0. Set it to player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()
It may be best to use label.equalsIgnoreCase("hello") so there's no issues with capitalization
where is your executor?
the class that extends JavaPlugin? Or another class that implements CommandExecutor?
package com.nik.niksplugin;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.material.Command;
import org.bukkit.plugin.java.JavaPlugin;
import net.md_5.bungee.api.ChatColor;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
System.out.println("Nik's Plugin has loaded!");
}
@Override
public void onDisable() {
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(cmd.getName().equals("hello")) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(ChatColor.DARK_RED + "Hello" + ChatColor.DARK_GREEN + player.getName() + "! Your health has been healed.");
player.setHealth(20.0);
} else {
System.out.println("You cannot use this command through console!");
}
}
return false;
}
}
it's not like that
the onCommand method is from CommandExecutor
you can't just write it out
To fix it : put on your onEnable something like this
this.getCommand("hello").setExecutor(new HelloClass());
and then your Hello class willl be
public class HelloClass implements CommandExecutor {
onCommand(...){}
}
but on the tutorial it was like how I had it
what fucking tutorial are you watching
put an @ Override before the onCommand method
yeah it's realy ugly that way but apparently possible
https://gyazo.com/94b35e6136e3415f4a59917380c61929 this was on the video
actually, @Override doesn't declare something as overriding another thing
it just checks whether or not it actually does override something during compilation, and if it doesn't, then it throws an error
it's literally just an informational safeguard :p
it's also to warn the compiler that it uses the method in parent and not a new one afaik
that method is never running
putting an override would help i'm almost sure
that actually didnt helped
since i cant edit the entity
the only thing the spawn packet stores is the entity id
in the setslot packet i can edit the itemstack using reflection
any help here pls ^
trying to edit an entity client-side only in the PacketPlayOutSpawnEntity
specifcally an item
JavaPlugin implements CommandExecutor already. All of a plugin's commands default to the JavaPlugin executor unless otherwise set. It's ill-advised to write commands in the JavaPlugin class but if you're writing a quick plugin, especially for beginners, it's fine.
And yes, always annotate your methods with @Override, it's a compiler hint and your IDE will complain to you if a method signature is incorrect. Helps prevent a lot of issues
With that being said, if the code you wrote above isn't working, your plugin probably isn't loading due to some error on startup
If you want to edit an entity that's been spawned on the ground, you have to follow up with an entity metadata packet where you can then use the link provided by Paloys as reference
https://wiki.vg/Protocol#Entity_Metadata
https://wiki.vg/Entity_metadata#Item_Entity
just find a thread in spigot about that lmao
here he used to change the nametag
following the wiki.vg, i need to edit the 8th index which is a Slot
what i put inside here
eh should I develop a plugin, or a packet spoofer for prison servers to get lots of igm
if I join a server and its packet spoofed im leaving
how tf they do this
with plugins
is it possible to replicate the solid beams in that video without a texturepack
@narrow vessel
guardian beams, end crystals and a resource pack
i made something similar but way more reactive to music
no
you can use the default guardian beam texture but you cant make it solid
hey
checking if an entity.hasGravity(), should return false
if they dont have gravity... right?
That's the intent, yes
how could i multiply a string/integer by 20?
?
how would i multiply a integer by 20?
mhm
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
i already know it,
Operator '*' cannot be applied to 'java.lang.String', 'int'
Do you wanna repeat the string or just multiply a number
just multiply a string by 20
- Convert the string to an int
- Multiply it
- Google questions next time
Integer.parseInt(str) * 20
this is the most basic of knowledge and I advise you to learn basics before implementing an Api
can someone make me a simple plugin that makes people spawn with items on there first time joining
Question also just wasn't really clear. Could also have wanted "Hello".repeat(20)
There are a number of these already publicly available that should work fine
they are way to complex to config at least for me
https://www.spigotmc.org/resources/playerkits-fully-configurable-kits-1-8-1-17.75185/ this seems pretty straightforward tbh and there is a setting to give a kit on first join
well is there a way on it to completely disable kits and only give items to people join the server for the first time
I don't use it, I use essentials kits for my first time players. But one would assume you could just remove the default kits already in the config and set the first join kit to an obnoxious time limit if there isn't an option for one time use lol.
Could also just....not give them the perms to not use any of them. š¤·āāļø
Would it be safe to change the worldborder async or could it cause issues?
what
Have bad experience doing some world related stuff async, so thought it'd be better to ask before having potential issues š
worldborders are async already arent they
its how datap*ck users use real-time over ticks
Ah right, makes sense
so how would i go about making a hypixel skyblock-esque talisman that gives the player a buff? i have the buff i just dont know how to check if the player has the item in their inventory
i use fromString
sorry wrong one
valueOf
Integer.valueOf
should i be using parseInt instead? or is it the same thing
parseInt sounds better to me atleast
valueOf returns Integer, parseInt returns int
weird
i havent had any issues
so i guess i'll start using parseInt?
does int extend Integer or something

how do i check if a player has an item in the inventory
a custom item
i tried looping through their inventory and checking for every item if it has the custom meta but that didnt work
Inventory.contains(item)
Is there someone online?I have troubles in plugins.I want to ask if there is a way to make the command support target selector.
Thank you very much! I find this function for almost one day!
I see that Bukkit.getOfflinePlayer() is deprecated. Is there a better way nowadays to get an OfflinePlayer object? I want to get it by searching for the player name in the chat, so I don't want to use UUID
It's deprecated because it issues synchronous web requests if the player is not cached
The only good way around it is to load every offline player into a big HashMap on startup and reference that
My library has a class for that, let me find it
So it doesn't mean it will be removed in the near future?
It doesn't, but it does mean that it can severely lag your server
Alright, thank you!
Well I'm using paper but I can't rely on their methods because I'm going to release the plugin so I'll have to do the workaround
I ran my command in command block.It works! I used "sender.sendMessage",However,there's no text in command block's last output?How to fix?
Does anyone know or know how to make a custom mob plugin
that takes vanilla mobs
and add texture packs to make a custom mob
/custom mobs
you can write a module
paper/
core/
then an interface UserManager
You'd make custom item models and put them on armor stands
or add the armor to the entity^
Can't
k
Armor does not support custom models
Im not a coder though
?services Then hire someone
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Bedrock edition has some great expandability. Wish things got ported over
mhm
I've heard that Mojang might be implementing a way for JSON entity models
Not sure if this is true or not
We'll see in 1.18
Whereād you hear that?
Forge discord. They've noted that a system to make it possible is already made. JSON parser is missing though
public static <T> void setField2(Class<T> clazz, String fieldName, T instance, Object fieldValue, boolean removeFinalModifier)
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
if(removeFinalModifier) {
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
}
field.set(instance, fieldValue);
}
i made a function to hopefully cleanup the reflection abuse mess in the above image, can someone check to make sure the function looks right (this is actually the first time ive made a function with variable type)
Uh what are you trying to do
just cleanup some code i have that injects custom material into bukkit
porting navidk0's carbon to 1.16 and turning it into an api i can use for later
java 16 changes reflection a lot?
Yes. It's a lot stricter now
There are startup flags to disable that but would be bad to force users
I had no idea you could inject custom materials to Bukkit. Is it even stable?
You can always do bad stuff with Reflections and such
i can inject the material but i cant get it to correspond it to the item that i injected into nms (thats a different issue ill try to resolve in the near future)
I mean if you really wanted you could get Mixins running
I would find a way without custom NMS items
Use a tag or simillar to find yours
In what situation would you want to add custom materials though
custom items can be done without nms but i want to also get into custom blocks and even oregen later
my end goal is to have "modded features" that "work" on both vanilla clients (with item remap) and forge clients
ok
I ran my command in command block.It works! I used "sender.sendMessage",However,there's no text in command block's last output?How to fix?
Why are you using command blocks
ikr lmfao
command block.. really.
sErvER i DeV on dOEsnT oP!!!
I thought about the combination of command block and plugin. I don't need it if I can't output it
You should avoid command blocks at all costs
send code
How can I send messages in sequences when interacting with a mob?
For example:
First click: Hey
Second click: Listen
Three click: Hello
and return for First
With a custom entity whoes have the uuid of the player and the number of the next message
You can put each instance of this object on an Map<UUID, Custom Object>
I will,thanks
Is this a bad way to check a mob's date?
wdym?
the baddest
suggestions?
switch, loop, extract method refactoring
but should with #has or not?
so either make your own method to make it switch compatible or just loop over
I have no idea how to think about running this loop, could you help me?
Is create a custom Object whoes store the last message of each mob a good idea ?
in what context
For the problem of Dimensions
what type are these objects of?
archer, stableman...
and is the citizenManager a custom one or from a public api?
š
I'm looking for a way to use stationary and clickable mobs like npc.
yeah but no
look up the java naming conventions, dont create a new instance of an object each method call, having a getter for everything isnt mostly the right way. here you could go by what @spring river said. making a class for each type which inherit from a superclass you can use for whatever you need
Developing an npc plugin is too complex.
I think I'll choose to use npclib instead of citizens because it's lighter.
I'm trying to set the biome in a specific region, this is my code. It only seems to change biome at random blocks over the region. Is there a better way to do this?
https://gyazo.com/882947848b7d34649522fe32a3040a9e
Do I need to loop every block in height as well?
It appeas that way.. takes a lot of time to complete this task and it would be dangerous to do it async, right?
don;t do it all in one tick
run it sync but a repeating task changing x number of blocks each time, until its done
Yeah that's probably the best idea, thanks š
how do i organize my code? I have a command with 3 args, each arg is sort of big
you could show us your code so we can actually tell you what you could do better
ok when i finish it ill do tht
how do i get the item in an entities main hand (eg a skeleton or a zombie)
without specifically casting to a skeleton or zombie
declaration: package: org.bukkit.inventory, interface: EntityEquipment
LivingEntity#getEquipment()
thx
How would I do to get around this problem? I can't compile due to that and I can't first define the variable because the scheduler requires it to be final
https://gyazo.com/7b8c21f073838384df0fd158ffdb57fd
do you actually need the taskId outside of the runnable ?
Use runTaskTimer so you can cancel it inside the task when you are finished
hey how to set block facing direction of blocks like chest?
You only need to pass the task either a chunk coordinate or two opposing locations.
Sure, use a loop
check if the display name in the item meta isn't empty
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
cuz ((LivingEntity) e.getEntity()).getEquipment().getItemInHand().getItemMeta().getDisplayName() == null doesnt work
oh
hasdisplayname
nvm
ive put checks
how can i change the weather?
ty lol
setStorm it was
wait i forgot how to get a world lol
Bukkit.getWorld("the world name")
how can i set blocks facing direction if i dont know what block it is
wdym
depends on your version
1.17.1 newest
i found this```java
BlockState state = block.getState();
PistonBaseMaterial piston = (PistonBaseMaterial)state.getData();
piston.setFacingDirection(BlockFace.NORTH);
piston.setFacingDirection(BlockFace.SOUTH);
piston.setFacingDirection(BlockFace.WEST);
piston.setFacingDirection(BlockFace.EAST);
piston.setFacingDirection(BlockFace.UP);
piston.setFacingDirection(BlockFace.DOWN);
state.setData(piston);
state.update();```
well this is for pistons
but it will prob work for chests and droppers
(except you don't case it to a PistonBaseMaterial)
What's the best way to detect a player having a lagspike? Just using ping or is there a better way?
idk then
you would have to ping the player a lot so that you don't detect false positives on laggy players
but you can also send keepalive packets if you want to dc them
There are too many causes of lag spikes for a server to detect a lagging player easily
I don't necessarily need an easy way but a good way š
To set a chest facing, cast the BlockData to Directional and setfacing
I've been trying to make a fork of Spigot to try to find an issue with beds and fix it (I'm not adding it to the issue tracker right now, as it might be my fault) but when importing Maven dependencies, it always says: Cannot resolve org.spigotmc:minecraft-server:1.17.1-R0.1-SNAPSHOT
If this is just the normal Minecraft server, I can add it to my .m2/repository but I'm not sure it's just that.
If it isn't, how can I fix this problem?
?learnjava I'm just copying these links this isn't telling anyone to learn java...
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
oh god
im gonna start making a teams plugin
IN 1.8.8
NO PDCS
this is prob gonna be my biggest project
can anyone help?
https://paste.md-5.net/qirusanihi.java @vale ember take dis example
its for 1.13, just hope it will work for 1.17
bump
Hi. Chest extends Directional. This means you can rotate chests by getting the BlockData, casting it to Directional and then calling setFacing(BlockFace) on it
Did you run BuildTools once on your pc? This installs the spigot dependencies in your local maven repository.
tbh smile and elgar are top 2 most helpful ppl here
but i want to do this not only for chest and for enderchest, dropper, and so on how do i do this?
yeah, multiple times even (for different minecraft versions)
use 7smile7's approach
always take his notices prioritized, he's one of the best out there ;)
i'll try running it again
Hm. Whenever i get problems like this i just look through this post again:
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
how do i check if given block extends directional cuz when i use (block instanceof Directional) it returns false
Directional is a SubInterface of BlockData. So you need to get the BlockData from the block and check if it is an instance of Directional.
tried this dont work too
Just make sure to call setBlockData(BlockData) on the Block after you modified the BlockData
dont work on echest
public void rotateBlock(final Block block, final BlockFace face) {
final BlockData data = block.getBlockData();
if (data instanceof Directional directional) {
if (directional.getFaces().contains(face)) {
directional.setFacing(face);
block.setBlockData(directional);
}
}
}
What version are you on?
Your IDE should tell you that what you are using is deprecated, right?
nah
Anyways you imported the wrong Directional
org.bukkit.block.data.Directional
work tysm
There are multiple types of lag spikes. Its only possible to detect a latency related one.
Alright ty
Did you add the jitpack repo?
Try reopening your IDE or just compile once. Sometimes the maven messages are weird.
This doesnt match up with the pom youve sent earlier.
Show your pom pls
Makes no sense. Do you manually add external jars to the project?
Did you manually add external jars to the project?
Because if you do you can throw your entire pom in the trash and not use maven at all.
How do you compile the project?
Does that build an artifact?
Or does that start a maven cycle
You are mixing a maven project and manual dependency management. This will break everything everywhere.
kaboom again
This is how you compile a maven project if you are a beginner: @quaint mantle
But if you have some bits and pieces from manually tinkering with your dependencies then you might be better off creating a new clean project.
How much code did you write so far?
Then first thing youll do now is getting the minecraft dev plugin for IntelliJ
so um
this migh be kinda complicated be
but
Player assigned = Bukkit.getPlayer(args[1]);
Player teamLeader = Bukkit.getPlayer(args[2]);
boolean assignedIsInTeam;
for(String childSection : plugin.getConfig().getConfigurationSection("Teams").getKeys(true)) {
if(childSection.equalsIgnoreCase(assigned.getName())){
plugin.getConfig().set();
}
i wanna check if a player (assigned) name exists under Teams
and if it is i wanna remove it
Then create a new spigot project, add your dependencies and try a clean mvn clean install with one dependency at a time.
Dont use FileConfigurations on runtime.
onEnable() -> load all your stuff from configs into data structures (classes, Lists, Sets, HashMaps etc)
onDisable() -> save all the stuff back into configs
And during runtime you use the classes
why
performance
it's faster to use objects in memory than parse the same file over and over
onDisable i clear config either way
lol
anyways
@lost matrix can you answer my main question
You cannot do that on the main thread.
Just set the section to null or something if you want to remove it
YEAH BUT
look
what i wanna do
is
look for a string in config
and remove the line it exists in entirely
If you properly installed maven then you can just write this into the terminal
Yes. Dont tinker with FileConfigurations but structure your data in classes and data structures.
Then use the buttons on the right for now. It uses the maven installation which is bundled with IntelliJ
Why would you ever do this
Sure. And if it where a thousand lists. Not a problem.
how would i even do that
i have 0 clue
Bruh
Give me some mins. ill write you an example.
thank you
Load from config into some holder
i hate 1.8.8
Itās that easy
i agree, ancient softwares are ass
1.8 is probably the least aids imo
Thereās nbt still what?
Nbts are easy anyways
idk how to use it too
Just research and search through src š
did you download the jars?
add
<scope>provided</scope>
to your SkriptLang dependency
Well the enginecraft (or however they are called) repo is missing
Also worldguard 6.2 is too old for 1.16
For now remove the SkriptLang dependency and see if it even compiles then.
lol smile did u give up
You are missing wg's repo anyways
Try adding the repo for worldguard:
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
Also the artifactId should be like this:
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>VERSION</version>
<scope>provided</scope>
</dependency>
You want the slightly more complex but proper way or the simple and manual way.
What are you trying to do? Write an addon for skript?
Then you should probably ask for help on the skript discord or their forum:
https://forums.skunity.com/forums/
Where can I buy MySQL ?
What do you mean by that? You can just install any database on your server.
for MySQL
hi guys quick question incase anyone can help me on the fly
what is the 1.17 equivalent of goalSelector and targetSelector in nms?
For moj mapped or obfuscated? (Because you can just apply the mojang mappings and read all fields and methods with their original names)
why does armorstand.teleport(Location) not works?
define "not works". What do you expect to happen and what is actually happening.
obfuscated is spigot's nms right
i expect that armor stand will be teleported and nothing happens
There is no spigot nms. You can apply the mojang mappings and read the code like it was written by mojang and then re-obfuscate it later
or you can read the obfuscated code.
what would the equivalent be then or how should i go about it
Any exceptions in your console?
no
Is it an actual ArmorStand that was spawned or is it spawned with packets?
default bukkit api
Then teleporting works as long as the Location is valid. Send more code pls.
proper
i am sure that location is valid cuz when i spawn it in same location its working but when spawning on 0, 0, 0 and teleporting to same its not working, here is some code
ArmorStand armorStand = CustomStand.spawn(new Location(location.getWorld(), 0, 0, 0), "Test");
armorStand.setVisible(false);
armorStand.teleport(createLocation(location.clone().add(0, 5 * Math.sin(Math.toRadians(i * 40)), 0),
5 * Math.cos(Math.toRadians(i * 40))));
// custom stand.spawn
public static ArmorStand spawn(Location location, String name) {
ArmorStand armorStand = (ArmorStand) Objects.requireNonNull(
location.getWorld()).spawnEntity(location, EntityType.ARMOR_STAND);
armorStand.setCustomName(ChatColor.translateAlternateColorCodes('&', name));
armorStand.setCustomNameVisible(true);
armorStand.setGravity(false);
armorStand.setVisible(true);
armorStand.setCanPickupItems(false);
return armorStand;
}
// createLocation
private Location createLocation(Location location, double right) {
Location resultLocation = location.clone();
switch (blockFace) {
case WEST -> resultLocation.add(0, 0, right);
case EAST -> resultLocation.add(0, 0, -right);
case NORTH -> resultLocation.add(right, 0, 0);
case SOUTH -> resultLocation.add(-right, 0, 0);
}
return resultLocation;
}
Pass 1.0 to createLocation and see if the stand is teleported. If not then your math just results in zeros all the time.
or 1.0 * i in your case
i said that results are ok cuz when i pass them directly into spawn method is works
Should be a long line then
setGravity(false); results in weird behavior regarding movement and teleportation. Try commenting that out for now.
I just realized in CraftServer.createWorld(String) I don't see it checking for settings from the world file? So how does it know the world already has generated data?
Did you dig deep into all the NMS calls? Because somewhere down there are def calls to some RegionAccessor or something
smile u there
Yes
proper :D
Too late. Ill give you the simpler approach now.
o ok
https://pastebin.com/mzJa65qs Not seeing anywhere where it could get called. (Even if not called directly)
Here are some lines you could follow: @stone sinew
There are literally hundreds of calls down there.
i checked, armor stands being spawned and if i never disable their gravity they getting teleported and falling down but i need to disable their gravity what to do?
So it works with the gravity enabled? Then set them as marker.
what is marker???
An armorstand that should not be ticked. No interaction, no gravity, nothing.
idk i tried to spawn them but they not spawned nor in location of spawn nor in location of teleport no erros
Yeah still not finding it... I'll just assume its called somewhere like you said
did they remove negative slime sizes in 1.17?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Before teleporting to spawn and back to guild:
[15:25:33 INFO]: [CCRP] Triggered
[15:25:33 INFO]: [CCRP] Triggered1
[15:25:33 INFO]: [CCRP] Triggered2
After teleporting to spawn and back to guild:
[15:25:33 INFO]: [CCRP] Triggered
[15:25:33 INFO]: [CCRP] Triggered1
[15:25:33 INFO]: [CCRP] Triggered2
Why is this happening?! This doesn't make any sense to me. Why is the menu after teleporting to spawn and back there, the beacon menu?
@lost matrix Can you help please? I saw, that you handled a similiar problem before.
Debug:
[15:25:33 INFO]: [CCRP] Triggered
[15:25:33 INFO]: [CCRP] Triggered1
[15:25:33 INFO]: [CCRP] Triggered2
this test is failing if(block.getWorld().getSpawnLocation().equals(block.getLocation().add(0, 1, 0)))
when i spawning armor stand and setting it's visiblity to false theres some ticks when it is visible to player, is there a way to fix this (i know that this is not bug)?
Yes. But that must be like that. the else method should be called
it will be VERY rare for a spawn Location to precisely match a Block Location
Like i said
Here is your example:
https://gist.github.com/Flo0/bf06ca310d1fcf1ee007df5ec0298f78
The task was:
Create a "weight" value for every Material in the game and let the user edit the weight by changing the config.
does anyone know how to change slime sizes to -1 in 1.17 or has that been removed completely? if so whats the new norm for armour stand position manipulation
sysout your spawn location and your adjusted block location
block.getWorld().getSpawnLocation().getBlock().equals(block)
Check equals on the block of the spawn location
You will see they differ
That's not the point. That must be false. And it is.
I didnt read any code yet to be honest. Lets see what you did there.
The problem that the Debug is alwys that, but the menu is not the same
If you expect that to be false, whats your issue? You code runs the menu beacon if that is false.
Is the beacon menu is overwriting my gui?
o
Beacon implements PersistentDataHolder.
Just write a system that checks the PDC of the block and open the GUI for the key thats in the PDC.
ty smile
Wait. Let me try something
it is possible to get texturepack from google drive by player.setTexturePack() ?
Uhm. If its a direct download link to the file and publicly accessible then you can provide the texturepack from anywhere.
oo, nice
You meant that @lost matrix?
beacon.getPersistentDataContainer().set(NamespacedKey.fromString("guild"), PersistentDataType.STRING, "guild");
hmm so why m i getting this error?
That is not theme of developement
what is the code you are using? @gleaming grove
but cant u just do
for(Material m : Materials.value()){
config.set(m.getName(), 1);
}
:D
Please go to help-server @gleaming grove
what
it is
wtfrick u saying, it is
A resource pack error?
Check your client log for hints.
Are you developing resource packs?
coding resource packs
ok
is still coding
can anyone help me š
yes it is part of plugin
?asl
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
Sorry. I lost the point. Here; Is this correct?
oh...
im so tired and ive been refactoring 1.17 all day
left the hardest till last my bad..
send ur code
public NMSSlime(Location loc, int size) {
super(EntityTypes.aD, ((CraftWorld) loc.getWorld()).getHandle());
WorldServer craftWorld = ((CraftWorld) loc.getWorld()).getHandle();
this.setPosition(loc.getX(), loc.getY(), loc.getZ());
this.setSize(size);
craftWorld.addEntity(this);
}
public void setSize(int size){
this.bK = size;
this.updateSize();
}
}```
but i cant help just ask some1 else 
trying to spawn this
basically i was just spawning a slime in prior using spigot's api, and setting the size to -1, -2, etc
and now in 1.17 it doesnt do that so i my holograms dont work properly
if theres another solution to holograms or another way to fix slimes id like to know
Holograms are usually done with packet based ArmorStands.
anyone please help wth armor stand with no gravity not being teleported via armorstand.teleport?
as of right now i'm spawning slimes for the mob name + the mob health bar so it follows them around and updates
If they have no gravity then they will not move.
i need the slimes to adjust where the holograms are at at all times
but i need them to float in air
int j = MathHelper.clamp(i, 1, 127);
this.Y.set(bU, j);
this.ah();
this.updateSize();
this.getAttributeInstance(GenericAttributes.a).setValue((double)(j * j));
this.getAttributeInstance(GenericAttributes.d).setValue((double)(0.2F + 0.1F * (float)j));
this.getAttributeInstance(GenericAttributes.f).setValue((double)j);
if (flag) {
this.setHealth(this.getMaxHealth());
}
this.bK = j;
}```
this is the current NMS code for setting slime sizes, it looks like theres a check between 1 and 127? so i made my own update method but to no prevail
Are they actual physical mobs on the server that just get teleported around every tick?
no theyre passengers to the custom mob i spawn
basically a lightweight way to handle them
i also worked around their collision, issue is i cant spawn them at the correct size anymore š¦
Ok good. Because a multi line systems should be done using packet based entities which are mounted on the target
if i do this however it is too tall/too small so thats why i need the slimes to adjust sizes
it gives me more options
unless im understanding the whole nms hologram thing wrong
Did you just extend the NMS slime and overwritten the collide method?
I tried to edit a plugin but I got this error
i did not overwrite the collide method
public NMSSlime(Location loc, int size) {
super(EntityTypes.aD, ((CraftWorld) loc.getWorld()).getHandle());
WorldServer craftWorld = ((CraftWorld) loc.getWorld()).getHandle();
this.setPosition(loc.getX(), loc.getY(), loc.getZ());
this.changeSize(size);
craftWorld.addEntity(this);
}
public void changeSize(int size){
this.bK = size;
this.updateSize();
}
}```
this is my whole NMSSLime class
to be honest im not an expert in NMS so i may have messed things up. 1.16 made things very easy, have i perhaps missed something?
There are multiple things you could do to make this slime more feasible for such a use case.
For one you should disable its AI. Then you should overwrite the collide method and prevent it from colliding with any entity.
If you want to use deobfuscated fields and methods then you should read how to set that up here:
https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/
Under the section NMS
ill read through this thanks
How did you try to edit a plugin?
but the issue still stands that i believe they removed negative slimes
Eclipse
IDE
I used the github source code to make a fork and changed it
then cloned it
Exported it to a jar
Realised I didnt have the yml files
then how to make an floating armor stand and move it?
Overwrite the the method
@Override
public void setSize(int size, boolean heal) {
int j = MathHelper.clamp(size, 1, 127);
super.Y.set(bU, j);
this.ah();
this.updateSize();
this.getAttributeInstance(GenericAttributes.a).setValue((double)(j * j));
this.getAttributeInstance(GenericAttributes.d).setValue((double)(0.2F + 0.1F * (float)j));
this.getAttributeInstance(GenericAttributes.f).setValue((double)j);
if (heal) {
this.setHealth(this.getMaxHealth());
}
super.bK = j;
}
And edit the first line to not clamp the value. Maybe that helps.
did it again and now im here
In your project there should be a plugin.yml
Inside this yml the path to your class that extends JavaPlugin should be present and point
exactly to the class that extends JavaPlugin. Also referred to as your "main" class
shud be com.colt.NoFall.NoFall.NoFall
One more NoFall at the end.
Btw. really really confusing path. packets should be all lower case if possible
plz help
NMS or Packets
tribble NoFall
yeh
only?
rly no way to make armor stand float and also move it sometimes?
What version are you on?
newest 1.17.1
leave same
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Hm. You could do something hacky like teleporting all the armorstands back up.
I just dont understand the package bit of java it is well weird
wouldnt it affect perfomance?
packages are literally just folders.
Yes
I hate folders
packages should also be all lowercase
well, then you should stop using computers
why couldnt computers just be one directory
so is it safe to use this method or i shud go by nms way?
You dont need packages. You can also just throw every class into a single clusterfucky pile and hope for the best.
performance and so you dont loose your mind
that sounds better lmao
A God class. The bestest ever
Its safe but your performance will suffer.
And use a single method for everything.
With a ton of anonymous inner methods and classes.
it happened again
I'm pretty sure that there is some library that allows to use lambdas for event listeners, so there isn't too much of a need for anonymous classes
did u recompile ur plugin cuz error says that ur plugin.yml's main is still old
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(new Listener() {
@EventHandler
public void onJoin(final PlayerJoinEvent event) {
event.setJoinMessage("Hi " + event.getPlayer().getName());
}
}, this);
}
The name of the main class is package.name.ClassName
pretty sure i did
right now you only have package.name
the fucking package name
did u changed ur plugin.yml, saved it and recompiled plugin and changed it in plugins folder of server
I deleted one of the folders
here
if you were to use lowercase package names it would be easier to identify your issue, but no, you have to play against the rules
just replace ur 2 line with this:
com.colt.NoFall.NoFall.NoFall
I wish I could unsee that
u sure
YES
How do you export the jar?
intellij?
Do you click on the project > export
he uses eclipse
but there is only the package and class here, only two .Nofalls I changed it
this needed 3 no falls
smh
YES third is filename
yeah and I only have one folder now
that has the name of NoFall
just take the package name with folders and your main class name
usually you should be using maven, that is way better than eclipse's export option
if u have only 1 folder that place 2 nofalls in plugin.yml
u just need to type all folder names separted with period and add filename at the end
google moment
i use it xd
and I did that
I got the error still
I use the export option, but only for quick tests and before it goes into prod
show ur dir again
Only use dependencies builders if its required. I wouldn't say it should be used if its not needed.
dir?

