#help-development
1 messages · Page 1902 of 1
Get the keys of kits, so kit1, kit2, etc, then use the returned string to get kits.x.items and store it in a map
?jd
lmao, i see why that wasnt working for me earlier
Are there actually more packets to send to the player to spawn an NPC?
ServerGamePacketListenerImpl ps = craftPlayer.getHandle().connection;
ps.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, npc));
//Spawn Player packet
ps.send(new ClientboundAddPlayerPacket(npc));
Because I am sending these 2 packets but I can't see them in-game
https://your-mom-is.taahyt.com/💀😴🐠🗻📮🐱.png is it possible to send this packet with 0 nodes
did you set the position of the NPC?
tried that now
but I thought these spawned on the player
nah it just lets the player know ur adding a player entity into the world
damn
doesn't seem to work
It shows up in tab, just can't see it
npc.setPos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
this is the right way right?
yessir should be
well, it isn't working
setting position before packet?
show ur npc code
Should I do that?
try it
mk
After shading some stuff with maven, it is now including everything except for my project compile output.
can anyone help?
project compile output? You mean the project itself
i mean yeah
it's just not including my project's class files
in the jar
my pom:
how can i get location from hashmap ?
Location location1 = new Location(player.getWorld(),warp.get(player.getName()));
@vocal cloud
nvm
Issue: On the issue line it says after onWeatherEvent it is asking for a ; but doing that would obviously break the code and wouldn't push forward with what I want
Use of code: I am trying to make when a lightning bolt strikes either near or on a iron ingot in this case it replaces it with a item called Lightning ingot
public class LightningBoltListener implements Listener {
@EventHandler
public void onPlayerEvent(PlayerDropItemEvent event1) {
if (event1.getItemDrop().getName().equals("Iron Ingot")) {
public void onWeatherEvent(LightningStrikeEvent event) { //Issue line
if (event1.getItemDrop().getLocation().getX() >= 1 event.getLightning().getLocation.getX() || event1.getItemDrop().getLocation().getZ() >= 1 event.getLightning().getLocation.getZ()) {
event1.getItemDrop().setMetadata(1);
event1.getItemDrop().setCustomName("Lightning Ingots");
}
}
}
}
}
I have zero idea what I am doing
I can see that
I am just using api and hoping
copium all the way here
alright, thank you
okay so
let me explain how to do it
so on lightning event
you loop thru all the entities that are items
around where it landed
and then check if it iron ingot
and then change it
something like that
should work
Just use PDCs
The same way you get everything else from a map. By using a key.
PDCs ?...
?pdc
How to do I check if a players Max Health Attribute is bellow a certain value?
player.getMaxHealth() < number
Get the attributes value and check it like every other number.
and dont use Player#getMaxHealth(). Thats deprecated.
Alright thanks
Yea I was just trying to figure out the last part since it wouldnt accept like
< 20
Because this returns an AttributeInstance
Would that mean I have to convert it? or?
^
thanks :D
Is creating my method for checking and notifying a player if he is inside a region every 1/2 second better than using PlayerMoveEvent?
No no don’t worry about that there will be a condition to check that
Not worried about the chat it won’t always notify just on enter and leave. I have my way of doing that but I’m just asking if making a timer that will check a player’s location to be able to see if he is inside a region better than checking it with playerMoveEvent?
Method:
@SneakyThrows
public void loadKits() {
kits = new HashMap<>();
File file = new File(getDataFolder(), "kits.yml");
if (!file.exists()) {
file.getParentFile().mkdirs();
saveResource("kits.yml", false);
}
FileConfiguration fileConfig = new YamlConfiguration();
fileConfig.load(file);
ConfigurationSection kitConfig = fileConfig.getConfigurationSection("kits");
if (kitConfig == null) return;
if (!kitConfig.getKeys(false).isEmpty()) {
Set<String> names = kitConfig.getKeys(false);
names.forEach(name -> {
List<ItemStack> items = (List<ItemStack>) kitConfig.getList("kits." + name);
kits.put(name, items);
});
}```
YML:
```yml
kits:
test:
- ==: org.bukkit.inventory.ItemStack
v: 2865
type: NETHERITE_HELMET
- ==: org.bukkit.inventory.ItemStack
v: 2865
type: NETHERITE_CHESTPLATE
- ==: org.bukkit.inventory.ItemStack
v: 2865
type: NETHERITE_LEGGINGS
- ==: org.bukkit.inventory.ItemStack
v: 2865
type: NETHERITE_BOOTS
- ==: org.bukkit.inventory.ItemStack
v: 2865
type: NETHERITE_SWORD
- ==: org.bukkit.inventory.ItemStack
v: 2865
type: ELYTRA```
Does anyone know why items would be null?
What is the most convenient way to store user data for a server that may only ever have 10 unique players? idk whether to go with csv file or database or what
maybe yaml files? @iron stream
Never heard of them before i'll check them out, thanks
don't build in a onedrive folder
The only thing in settings.gradle is rootProject.name = 'FastStats'
Why?
because sync programs suck and lock files or just do weird things
I've never had issues with OneDrive
How do I like get player chat logs and send them to and operator
Like CommandSpy
But only for commands
PlayerCommandPreprocessEvent
can we not add potion effects to a player when we are inside a scheduler task?
the error is asynchronous effect add
but doesnt synchronous stop your code?
that would be unfortunate
because im trying to make it so every second the player has a certain helmet
Adding a potion effect is not going to be a big deal synchronous
it gives him night vis
yeah no but its a loop that runs in the background
loops thru players
and sees if a player has the helmet
Yeah you don't need async for that, async is for extremely heavy operations like read/write from IO
Well, no, it does it on the main thread but that will take basically no time at all
Unless you have a hundred million players, then it might
Yep, just use that. No need for async.
alright thank you very much 😄
I mean you can access players asynchronously from ::getOnlinePlayers if you need to
You can't add potion effects asynchronously apparently
Yeah probably not
why not tho?
Because a potion effect is only lasting for a specific amount of ticks right
@ivory sleet, do u know much about yaml?
That countdown has to be done somewhere, and if it’d be done asynchronously then you’d run into other concurrency update problems
@sleek turret yes
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
i did, no one answered
Bump it?
Reply to your message
here
output each variable and see what is null
Probably wanna use "kits.test" as Path
He is
And then get it as a MapList
"kits." + name
yeah, im getting the keys, then going kits.test
yeah
Yeah well Idk if spigot supports a yaml sequence of configuration serializable
Like as api
Also why sneaky throw? Just try catch possible throwables
Just lazy
You thwart the very reason Java invented checked exceptions
lmao
But btw you can print out a YamlConfiguration instance I believe
and it should yield a string representation
(Or use some sort of break point if ur ide supports that) conversely to just print it
yeah im just gonna print it
Ye, this is the first time I have had this issue.
hello\
i need help with change the api from 1.17.1 to 1.18.1 the jdk it was build around was 17
i need to change the dependency from 1.17.1 to 1.18.1
i made it 1.17.1 in the past
spigot api
just change it in ur build.gradle or pom.xml
from 1.17.1-R0.1-SNAPSHOT to 1.18.1-R0.1-SNAPSHOT
@snow crow
I have a class that queries a database and returns a boolean whether or not a player is already in the database. I need to surround it with a try/catch loop in case there's an error, but I'm unsure what to return in case there is an error (since it's neither true nor false). I've considered doing throws SQLException and then throw new SQLException();. Should I stick with that or do something else?
hey guys, maven is packaging everything except for my project files
I'm using maven shade plugin to shade mongodb classes
here's my pom:
well, the issue isn't that the boat doesn't float on lava
it does
it just breaks if the player tries to ride on it
I just cancel the damage event
the boat doesnt break
the issue is that it doesnt float
texture packs that make water look like lava, and lava look like whater but remove the effects from the lava that should be water and leave it on the lava trhat should be lava
hello! i was wondering if there was an easy and more optimized way of doing this?
package me.mrhonbon.opmobs;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.inventory.ItemStack;
public class MobSpawns implements Listener {
@EventHandler
public void onMobSpawnEvent(CreatureSpawnEvent e) {
if (e.getEntityType() == EntityType.CREEPER) {
Creeper creeper = (Creeper) e.getEntity();
creeper.setPowered(true);
}
ItemStack helmet1 = new ItemStack(Material.NETHERITE_HELMET);
helmet1.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
ItemStack chestplate1 = new ItemStack(Material.NETHERITE_CHESTPLATE);
chestplate1.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
ItemStack leggings1 = new ItemStack(Material.NETHERITE_LEGGINGS);
leggings1.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
ItemStack boots1 = new ItemStack(Material.NETHERITE_BOOTS);
boots1.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
ItemStack sword1 = new ItemStack(Material.NETHERITE_SWORD);
sword1.addEnchantment(Enchantment.DAMAGE_ALL, 1);
if (e.getEntityType() == EntityType.ZOMBIE) {
Zombie zombie = (Zombie) e.getEntity();
zombie.getEquipment().setHelmet(helmet1);
zombie.getEquipment().setChestplate(chestplate1);
zombie.getEquipment().setLeggings(leggings1);
zombie.getEquipment().setBoots(boots1);
zombie.getEquipment().setItemInMainHand(sword1);
}
}
}
i am a beginner so i apologize if this isnt the most optimized, but this code does work and does what it does, i just want to know if i can save some lines of typing with better code 😁
I don't want to use a texture pack
oh ok
why do you want boats on lava
you can ride striders, they're a lot better than boats
yes
i dont think there's really just a straightforward way to make boats float on lava in spigot
cuz y'know
a boat that can walk on land
it's hardcoded for boats to sink, i think
ye
a texture pack that turns striders into boats that you can put a saddle on
and boats into striders
mhm
:dynoError: The AFK module is disabled in this server.
it also might work if you cancelled the VehicleMoveEvent that gets called when the boat sinks down into lava
i saw that in this thread https://www.spigotmc.org/threads/question-is-there-a-way-to-ride-boats-on-lava.483779/
Welp, you can
MysticCat did this with only commands block
So with the power of coding, why can’t we improve his concept
ok tbf
i did just send this
anyone?
;-;
I don't see the shade plugin in there
Huh idk. Have you run mvn clean and everything to make sure it's not something gummed up in there?
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
``` this is the build I use and it works
Tho watch the java version
Well I moved it out, and I got my favorite... still errors, but it is a different gradle load error.
Anyone know what i am doing wrong? I'm trying to set a player head to a custom skin
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD); // Amount is 1 by default
SkullMeta playerHeadMeta = (SkullMeta) playerHead.getItemMeta();
playerHeadMeta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString("a68f0b64-8d14-4000-a95f-4b9ba14f8df9")));
playerHeadMeta.setDisplayName(Color("&c&lGo Back."));
playerHead.setItemMeta(playerHeadMeta);
Errors?
has the player already logged in once?
D:
Nevermind fixed it
what i am trying to do is make a variable change from off and on to make events happen.
the easiest way i can describe this is something like this: if (toggle) is on: do stuff) and: if (toggle) is off: do stuff
so could someone assist me in making a command (/opmobs on|off) that defines whether a variable is off or on? (sorry if this is hard to understand i am just beginning with java and spigot development)
ok yeah have u first made a command?
so if (cmd.getname.ignoresCase("opmobs"){ --- }
As I would tell everyone
There are plenty of tutorials on how to use the spigot command library out there
But it's kinda terrible
You should familiarize yourself with it, then abandon it in favor of a command framework
Hello, I have a problem I would like to create a plugin in 1.18.1 but I have this error
Searched in the following locations:
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.18.1-R0.1-SNAPSHOT/spigot-api-1.18.1-R0.1-20220108.231739-38.jar```
How do I add my custom items to mob drops?
how do i spawn mobs on playyer's location?
well lightning to be exact
Hm?
You wanna spawn lightning on player's location?
I think its supposed to be strikeLightning
honestly if there was native bukkit support for Brigadier it would be pretty poggers
i think ur spawnCreature method has no logic in it
there is a problem with spigot because it is impossible to create a plugin in 1.18.1 🤔 end it tells me that it can't find the link for spigot
maybe try downloading build tools and building it natively?
apply plugin: 'idea'
group 'fr.aldraziel'
version '1.0.0'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
task javadocJar(type: Jar) {
classifier 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allSource
}
compileJava {
targetCompatibility = sourceCompatibility = JavaVersion.VERSION_17
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
maven {
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"
}
maven {
url "https://hub.spigotmc.org/nexus/content/repositories/public"
}
}
dependencies {
api 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
api 'org.jetbrains:annotations:22.0.0'
}``` the link redirect to a 404 error
😒
Working for me
👀
Could not find spigot-api-1.18.1-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT:20220108.231739-38).
Searched in the following locations:
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.18.1-R0.1-SNAPSHOT/spigot-api-1.18.1-R0.1-20220108.231739-38.jar
``` hummmm
Gradle?
yes
maven > gradle
--'
🤔 is possbility
maven forked for me
worked*
i just created a project
u can always migrate ur code
I'm going to test with maven I'm not ready 😛
It seemed to work for me
it's just that the pom.xml that's what :x
Might need to invalidate your caches.
then I use intelliJ <.<
wait u use eclipse?
no IntelliJ
yeah intelliJ is better
dw
well
@EventHandler
public void onDeath(PlayerDeathEvent E) {
Player player = E.getEntity();
Entity killer = E.getEntity().getKiller();
player.setGameMode(GameMode.SPECTATOR);
getServer().broadcastMessage(ChatColor.DARK_RED + "! "+ player.getName().toUpperCase() + " Has Died!!");
Location killerLoc = killer.getLocation();
if (killer instanceof Player){
Player killerPlyr = (Player)killer;
killerPlyr.setNoDamageTicks(20);
player.addPotionEffect(PotionEffectType.HARM.createEffect(15, 2));
player.addPotionEffect(PotionEffectType.SPEED.createEffect(60, 5));
}
spawnCreature(killerLoc, EntityType.LIGHTNING);
}
private void spawnCreature(Location killerLoc, EntityType lightning) {
killerLoc.getWorld().spawnEntity(killerLoc, EntityType.LIGHTNING);
}``` this works right?
also i cant register this event
oh wait nvm
E
E
As a general rule u shouldn’t name ur variables in uppercase as the first letter
I have an sql time object (https://docs.oracle.com/javase/7/docs/api/java/sql/Time.html) and I want check how many minutes have passed between then and now. Everything I could find online relies on Time#getTime(), which is supposed to return the time passed since 1970 in milliseconds but gives something completely different. any ideas?
what does it give
this
the time is about 2 hours ago
it's supposed to return something very close to this (which is current)
Time zones perhaps
Probably. Use timetamp instead
can you show code?
I am pretty sure your issue has to do with conversion
SQL stores time as hh:mm:ss and not in milliseconds
however SQL time understands various formats for time too, so it all depends on your code
also depends on the system as well
How can I compile a jar with both the Spigot API and NMS in 1.18.1 for my plugin? (I'm using the latest BuildTools version)
if you mean purely just api and nms and do not require a remapped version of the nms packages, then the normal command is sufficient
java -jar BuildTools.jar --rev 1.18.1
it should be in your local maven repo
oh
under a different artifactId
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
How can you disable mouse movement completely like in Origin Realms?
technically can't o.O
And also the wasd movement
setSpeed to 0
That affect the mouse movement?
So amazing that they can do that
Maybe force player to spectate some entity? Iirc you cant move nouse in that case
how can I put a block to somewhere with plugin
how do i send a title to a player?
quick question. do player.setHealth(0.0D); bypass the 3 second invulnerability that minecraft gives when the player just respawned/joined the server?
what makes a player isInvulnerable() ??
read the docs
sethealth bypass everything
hi what do I do here?
download jdk 17
I did
I downloaded this https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot
try this one
not necessarily
oh okay ty
does minecraft set players as invulenrable when they joined/just respawned/in creative?
🙃
well im too lazy to try and see so im just gonna make a list that will contain players after respawning for 5 seconds
so I just tried and and see and it turns out it only returns true when player is in death screen. returns false after join/respawn and on creative
isnt there a grace period after respawning?
well on my game there isnt..
maybe its some other stuff that blocks damage and not invulenrable
any extreme cool rich command-lib/api ?
?paste
I want to make a Class that implements Player, so i can get some other informations, which I write in the Class ,from the player but also can get infos like getUniquId. But When i cast it, I become a ClasCastException. How can I do that?
My code (My CommandClass):
public class TestCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player p = (Player) sender;
CostumPlayer cp = p;
Bukkit.broadcastMessage(String.valueOf(p.getUniqueId()));
return false;
}
}
My Class which implementes Player:
https://paste.md-5.net/alasenuwad.java
well no.
How?
Help After Changeing the api version in pom.xml
dont make it interface/abstract and create an constructor that contains the player obj
log in thread
public class Otherthing {
private Player player;
public something(Player player) {
this.player = player;
}
}
basic premise of a wrapper
ok
@spiral light sure, but its basic stuff so I have no problems with that 😛
Also make sure to dispose of that class from any maps when the player logs off
discord is going to eventually teach us we can efficiently speak with images and emojis without using words 😄
🆗
Decorator 🙄
I don't know if this is a bug or a error, because when i try to reload the config of my plugin doesn't work
pd: i'm using reloadConfig();
What doesn’t work
when I try to reload the config of the plugin, the "config.yml" file
doesn't reload the config
if (command.getName().equals("authentication")) {
if (arguments[0].equals("reload")) {
if (entity instanceof Player) {
main.reloadConfig();
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', (String) this.main.getConfig().getString("message.reload")));
} else {
if (entity.isOp()) {
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', (String) this.main.getConfig().getString("message.reload")));
this.main.saveConfig();}
}
}
}
i tried with two forms but doesn't work any of it
did your register the cmd ?
yep
does it send you the msg after reloadConfig ?
yes
and no error in console ?
Is there a way to set a serverPlayer attackable and allow it to attack another player. The serverplayer is an npc added by me.
if (player.getWorld().getBiome(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()).equals(Biome.DESERT)) {
Can i add here a list from config so it detects what biomes have the person wrote in the config, or how could i do that?
do you spawn it with packets?
And then you can check if a list .contains said key
Yes
only packets dont allow the server to know that there is a entity ^^
ok, thanks!
adding npcs that are attackable and attack by them self are a bit tricky ^^
Well, how would I go about doing that?
listen to many packets and recreate how the player would move from A to B and how it attacks and how other player interact with it
what is waaaaay to diffucluty
or: create an real entity and modify the spawn packets to spawn your player instead .... it will look like an npc and attack/move how you want and the server handels everything for you
And that is just a zombie and send the same packets as I did with the player or different ones?
you can use whatever you think is the best ... of course it makes sense to take an entity that has already a behaviour you want to do
if you want those npcs to be a normal peacefull mob you can use an Villager and modify some stuff to make it usefull
^^^
so
ye again xD
Error occurred while enabling EnderRider v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: The embedded resource 'config.yml' cannot be found in plugins\EnderRider.jar
much reilable and prevents for a lot of asspain
you can even interact with your npc through bukkit api
if they should attack players like zombies use zombies .... if you want them to shoot you need to use skeleton/pillager
Is there a website or a way to see all of the packet with mojang remapped names to see what they do, because I have never even worked with packets except for these two that I did with a tutorial
you can do a custom pathfinders with nms or paper api ^_^
kelp
you need to wait for the website to finish before searching on top left
this just sucks to use because spigot servers will not support it
just wait a little bit for hangar
That website is kinda confusing
if you want to know how "PacketPlayOutEntitySpawn" is named in mojang mappings it is perfect ?
private ArrayList<Biome> biome = new ArrayList<>();
biome = (ArrayList<Biome>) getConfig().getList("biome");
if (player.getWorld().getBiome(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()).equals(biome)) {
Something like this would work to get a biome list from the config?
Sure, but if I want to see what they do
you can make optional paper support that will work on every version, and nms ones for spigot
of course you will not get an explanation of what what does ...
this is not going to break spigot rules 😉
the names are self-explanatory too
or you just use spigot because you want the same behaviour on all versions ^^
Ok, but for example, on my own I would've never found out that I would need 2 packets for a player
you can only know this because of reading other ppl did it or reading the server jar
do i need worry abt this
or it the plugin first time starting
Like let's say you needed to make the same thing as I am. How would you find out how to do it without prior knowledge about the packets etc?
you probably moved config.yml to a wrong place or use the method without having the config.yml provided
google ^^
also if you dont know much about api / packets stuff you shouldnt do some npc stuff^^
so the config is in the resource tab and if its the method where would i have to change it
image of your datatree would help
okkie
also possible that your pom is not configured to include those resources
This the paths with . pom.xml
Is there a quick way to disguise these mobs?
quick xDD no
packets nms everything isnt quick at all
you rly have to know how you would do that stuff
Yh, I really don't 😅
you would need to listen for outgoing packets and make sure the packet for your real entity will not reach the client ... instead you need to spawn an npc with the same entityid of that real entity
also you may need to resend the equip + metadata stuff again for the player to make sure he can see it
where to put it ?
outside of meta-inf
ok googling
? just put it in "resources" and not "resources/META-INF"
ok
I'm going to use libsdisguises to disguise some entities. It doesn't want to import, do I need to actually download the .jar file to my pc?
you should check out their spigot-page/github if they support maven directly
https://www.spigotmc.org/wiki/lib-s-disguises/ This should be a guide to install it, and they are just doing it through maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
did you add the repository ?
Yes, but isn't that the spigot one?
wtaf
It didn't work as I did it 3 times, now I do it again, and poof
works straight away
im back again 🙂 xD
[16:30:59] [Server thread/ERROR]: Could not load 'plugins\EnderRider.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
.
i dont have the idea where to put it
can you help me rearrange stuff im on intelij
Does just renaming ja.jaai.enderrider to src work?
hey does anyone know how to fix client side visual glitches?
wait wont that mess up locations
Which ones
i have a setcancelled thing for water, but on the players screen it shows the water is gone
before and after
the anticheat went crazy
because people can jump in those holes
hm well someone just got banned for jumping ontop on ghost air
how so
just set the block?
block.update maybe
is this a good way to shade hikaricp?
https://www.spigotmc.org/threads/hikaricp-with-spigot-not-importing-with-the-jar.246851/
you should also relocate
hmm that didnt work previous time i tried
you did something wrong
[16:52:38 ERROR]: Could not load 'plugins\EnderRider.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.loadPlugins(CraftServer.java:415) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:231) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:994) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3408-Spigot-f4ff00f-74a5cc8]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 7 more
im back again
lol
if (player.getWorld().getBiome(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()).equals(loadBiomes("biomes"))) {
if (!(getPlayerHeat(player) >= 100)) {
setPlayerHeat(player, 1);
}
} else if (!player.getWorld().getBiome(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()).equals(loadBiomes("biomes"))) {
if (getPlayerHeat(player) >= 1) {
setPlayerHeat(player, -1);
}
}```
why does it says that the if are always false?
you need to create plugin.yml
They have one
yes
Their folder structure is just messed up
i just dont know where to place itt
src/main/resources
why don't you use intelijj plugins?
Just like your code should be in src/main/java
coll
What
i have plugins
do you maybe know why this says that the if is always false?
plugin.yml has to be there
wait if i dont have config file
The heck does loadbiomes do
what does clean package do?
nope
just no
dont run loadBiomes everytime you need it ?
maybe save it somewhere.
if biome equals a list of biomes???
that doesnt make sense
oh
does anyone knows what clean package goal does?
cleans stuff or something and packages it?
aah
clean clears the build directory of all files and the build directory itself if able. Package compiles
you shouldn't use clean unless necessary
otherwise it prevents using maven builds which utilizes caching so that it doesn't need to re-compile everything
just only what changed
i had like 3 jar files when i used the shade plugin
however, if you utilize shading every so often you will probably need to use clean especially if dependencies being shaded were updated in the pom
does just mvn package replace existing jars forced ?
mvn package just creates the jar
original, contains your project class files nothing else before shading, shaded is all the stuff/dependencies placed into the jar, and the top one is both combined
wdym combined?
Both jar files merged
shaded doesn't contain your project classes, it contains the stuff that you wanted shaded
original is your project classes
oh
the top one is both those jars combined
So?
jdk.internal.icu.impl.NormalizerImpl any alternates for this or dependency
cant ti just change that it only outputs the combined jar and nothing else?
if you configure maven shade plugin to do so yes
What does it even do in the first place?
And why are you looking at JDK internals? Most IDEs hide them from you
however, most of the time it isn't necessary even when you push builds to a maven repo
because maven only uses the end result jar
unless you specify you want all the jars pushed then it would do that as well lol
that's why he said i'm back
and what does this do? (plugins configuration)
it is for transitive dependencies and the META-INF file that maven creates
It's literally the same library so it would be a drop-in solution
ok 🙂
there is a pom file in META-INF that maven uses when your jar is used as a dependency and this is how it knows there is more dependencies, however when you shade this gets kind of screwed up because some of the dependencies are technically not dependencies no more as you just put them in your jar, so dependency reduced pom means, that it will remove dependencies from the pom in your compiled jar if they were shaded into your jar
setting it to false prevents maven from doing that
generally you should create it so that transitive dependencies can be picked up properly
but most of the time, it doesn't really matter as long as you document your project appropriately as well
if you are making an API that shades in some libs to be part of your API, you should generally set that false for the setting
for everything else, it should be true
so i can set it to true?
if you want. It isn't going to do anything terrible to your compiled jar or project regardless of the setting
hmm i'll just leave it away
Does anyone know about NoteBlockAPI here?
what is the problem maybe we can help you anyway
you should look for help on their page ^^
I think it is radioSongPlayer.setLoop(true) but it is deprecated
does it say what to use instead?
perhaps
🍞 🦆
why do both HikariDataSource and HikariConfig have the ::setDataSourceClassName method?
how can I use the spigot mappings for NMS on 1.18.1?
I do not think that they exist for 1.18.1
Spigot mappings are dead
ugh
but they are bearably readable
why that
you just dont know the right names ^^
if i want to connect a player to a server in a bungeecord plugin, but the server is not online, then the connect command simply says that no server was found in the chat, but how do i get a response in the code if the server is online or not?
Just check if the server is online before you try to connect him
how do i check if the server is online?
idk... get the servers inet address and ping it
alternatively do a more proactive approach and do a requirement that the server needs to ping the bungee server every few minutes, if it didn't it might be because it is not alive
A bit harder to pull off though and does not have a real benefit, but I've posted it anyways just for the sake of showing that there are multiple ways of solving this problem
- Get the targets IP and port via plugin messaging channel
- Ping the address
boolean reachable = InetAddress.getByName(ip + ":" + port).isReachable(3000);
Hm this looks like it deserves a utility class...
does this looks good? only wrong port xd
Not much more to Hikaricp. Looks fine.
I woudllnt do code in constructor, but otherwise just pass data Source and provide a static factory method
Also consider using MessageFormat.format or string format() for jdbc url
do anyone know the 1.18 way of this packet: PacketPlayOutWorldBorder ?
Yeah its usually a better idea to have a pure configuration data class that you can (de)serialize. Instead of having a constructor handle that.
Double shift and search World Border
Runtime.getRuntime().exec("/home/minecraft/bungeeServer/survivalServer/start.sh");
Can you use this command to start a server?
What i found for border
hmm
So center and size should be enough
It has some conditions but yes. The path will most probably not work tho.
ah i understand, but what's the difference between String.format and MessageFormat.format?
performance?
what conditions?
permissions for example. If the admin uses different owners for your application and the bungee server then you will probably run into permission problems
And the shellscript must be executable (chmod)
Well, format.. I like MessageFormat more
Method on string uses %s %d as placeholders
MessageFormat uses {0} {1} {2}
so you dont have to worry about types?
How would I detect when someone buys something on a villager? Is there any event or I need to use InventoryClickEvent?
MessageFormat just calls toString on objects
The Objects#toString or the Object#toString()?
Eh, the difference is probably irrelevant here
its been split up into multiple packets
its no longer one packet
https://wiki.vg/Protocol might help
search for keyword "Border"
k thanks
WarningDistance + center
set the warning distance hella high
and the center hella far
What is the advantage to Check for the command name before run the command?
Nothing. Its completely pointless in almost all cases.
Is there a tick time remaining counter anywhere I can grab?
Unless you use the same executor for several commands.
Ok
What do you mean by remaining?
Really I just need to know if the tick has overrun or not at the time i check
to know if i should schedule a task for this tick or next
public void onDeath(PlayerDeathEvent E) {
Player player = E.getEntity();
Entity killer = E.getEntity().getKiller();
Player killerPlyr = (Player)killer;
player.setGameMode(GameMode.SPECTATOR);
if (killer instanceof Player){
getServer().broadcastMessage(ChatColor.DARK_RED + "! "+ player.getName().toUpperCase() + " was killed by "+ killerPlyr.getDisplayName());
}else{ getServer().broadcastMessage(ChatColor.DARK_RED + "! "+ player.getName().toUpperCase() + " has died!");}
Location killerLoc = killer.getLocation();
killerPlyr.setNoDamageTicks(20);
killerPlyr.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(15, 2));
killerPlyr.addPotionEffect(PotionEffectType.SPEED.createEffect(60, 5));
``` hey, this is a event listener and in the last 2 lines there are potion effects i get them but for what feels like a tick
Because the executor has no idea how long the current tick will last.
I'd be fine if it was negative in such an overrun for example
just some way to know if i should let a tick tick or keep spamming the current one 😛
Ah i see. You would need the nano timestamp at which the current tick has started. This is not exposed in the SpigotAPI.
You can obtain it using Paper.
Is there a way to color Arguments when you enter the m? Because by Default they are blue
brigadier - see CommandAPI plugin
was this for me?
that was for me lumina
ohk alr
Look at CommandAPI, ACF, Cloud and Commodore
OK
Idk if ACF supports colors, but mini wrote sth for suggestions I believe
hey can someone help?
Perhaps extend the duration a bit?
no i think that wont help
Bruh
The duration is in ticks
Because Minecraft’s primary time unit is in ticks
The game engine’s update rate is in ticks (ideally)
why wouldn’t it be
faior
fair*
killerPlyr.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(300, 2));
killerPlyr.addPotionEffect(PotionEffectType.SPEED.createEffect(1200, 5));
``` good now?
Then use the respawn event and not the death event... lol
Then use both events
Believe it you could simply invoke Player::getKiller
which returns the last player who killed the player you invoke it on

i just wanted to fix the strength and speed!
Dont use a delay. What if the player waits in the respawn screen for some seconds. Then he wont have an effect when he respawns
the killer gets it haha
not the player
also im not being rude!
didnt really read your code tbh
btw dont use your events E and also not e
E is both dirty AND violates the java standard. And e is just dirty
is it possible somehow to rewrite public static final fields in the newer java versions ?
to?
a custom thing
such as?
should i mention i wanne use reflection ?
What else would you use... lol
oh you wanna change the value of a static final field?
i am stuck with shooting pigs instead of arrows while /summon works correctly
yes
you might need to use unsafe****
but even then you can only change certain things
iirc setting value of static final fields is not possible anymore with reflection (regardless of type or anything else)
Is it a primitive field?
primitive static final fields are inlined. Im not sure about Enums...
There is also no way to change constants using reflections anymore
What's that bundler command or whatever it is?
enums get inlined also
f
and yeah, then we have jigsaw which may also prevent reflective manipulation
i dont want the enum entitytypes... i want the nms-EntityTypes ... i can overwrite the entitys that spawn with /summon but for example shooting arrows it wont work and it will somehow shoot pigs and not arrows
You can even change that behavior with just the spigot API
not rly... i want to make some changes to the arrow nms class ... so i need a new entity
Just make a new arrow class instead of changing the current one
isnt it cleaner to have the default stuff overwritten then replacing every time ?
How would I be able to center a text and have its color?
I tried with StringUtils.center but to no avail
hey
Centering wont work as every client could have a different font and different chat settings
but for like
the default font
default mc font
thats what I'm most concerned about
Its not monospaced so you would need to know the pixel width of each character in the String you want to center
And StringUtils.center should work just fine
Show some code @hollow sand
Just a guess: You forgot that Strings are immutable
kk
"Serious"

hmmm 7smile7,
what about reflection of private final... is that possible ?
Yes
oh wait, let me rewrite it with other words....
is that still possible like you would do in older java versions with reflection ?
I believe sometimes inlined if it’s like
private final primitive variable = primitiveValue
Hmm
Well
You can just use setAccessible
and then change it reflectively
Always been able to
Except if the private member is in another module, then it is not possible
There are a few catches with that statement if I am right, but let's not list them
Yes well he pointed out older versions
So I assume he meant pre strong encapsulation jep
well, I assume that "like under old java" suggests that JPMS is used
¯_(ツ)_/¯
Hello, I was wondering if there is a way to specifically check if an ItemStack is a tool?
thought this should work ? @ivory sleet
what field is it?
private final
idk
its the factory for the entity
wont help 😄
btw your ide has marked it yellow
i catch the error and print it ... probably thats why
wut
you mean this ?
yeah its because the obfuscated name is bm ...
oh right
Pretty sure that you can achieve what you want without tinkering with those fields. Minecraft is quite data driven already.
i was pretty sure it will work too
okay im trying it out myself free soccer
but somehow player shooting arrows will directly use the Field in EntityType instead of catching it from Registry
How can I make it so then when I remove a players health from the maxheath attribute it will keep the data and not reset them to full 20 hp and keep them at for example 18hp ?
Setting the attribute should not change a players health
wdym?
If you change the GENERIC_MAX_HEALTH attribute then the players health should not be changed as a result.
Hmm okay weird I'll take a look again and see what might be causing it
Be aware that im only about 75% sure about that.
Yea, All my code currently does is get the value of their hp then remove - 2 but it resets to 20 every time
What spigot version are you using?
1.18.1
Hm show me your code then
If it resets the health just set it again after changing the attribute
Player player = e.getPlayer();
double PlayerHP = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
if(!player.isDead()){
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(PlayerHP - 2); // TEST THIS !!!!!
}
}```
You probably have the spigot options set to always show 10 hearts and not scale the health bar based on the max health attribute
Where would I be able to change that?
spigot.yml i think
Alright I'll have a look
And you should not get the value after all modification but the base value
._.
public void decreaseMaxHealth(Player player, double amount) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
assert attribute != null;
double current = attribute.getBaseValue();
attribute.setBaseValue(Math.max(1, current - amount));
}
ahhh
Where Bing toolbar and msn messenger?
🥶
discord is the real shit fuck messenger 🥵
Move to irc 🤓
🥺🥺👉👈
Wth
Assertions!!
restart your pc? Looks like some lock is locking your files
im grabbing the file from a shared network drive
Just so my IDE doesnt yell at me
Objects reqnonnull
public void decreaseMaxHealth(Player player, double amount) {
AttributeInstance attribute = Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH));
double current = attribute.getBaseValue();
attribute.setBaseValue(Math.max(1, current - amount));
}
Was about to write that
Also viable:
public void decreaseMaxHealth(Player player, double amount) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
Preconditions.checkNotNull(attribute);
double current = attribute.getBaseValue();
attribute.setBaseValue(Math.max(1, current - amount));
}
meh
Anyone know why this isn't working as it should be?
public void play() {
for (int i = 0; i < noteList.size(); i++) {
Optional<Note> map = noteList.keySet().stream().findFirst();
Note note = map.get();
int wait = noteList.get(note);
int totalWait = wait + ticks;
ticks = ticks + wait;
noteList.remove(note);
new BukkitRunnable() {
@Override
public void run() {
if (!shouldStop) {
Bukkit.getOnlinePlayers().forEach(player -> {
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 1, note.getPitch());
});
}
}
}.runTaskLater(Main.getInstance(), totalWait);
}
}```
In the noteList are 4 keys/values, but it only plays 2 notes.
My noteList is: HashMap<Note, Integer> noteList. The Integer stands for the amount of ticks it needs to wait to be played after a note has been played
yea
TextComponent crackpixel = new TextComponent(ChatColor.YELLOW + StringUtils.center("CRACKPIXEL NETWORK", 13, " "));```
I tried this
didnt work
its just sent out
But you know how I can let it work?
the text on how you would normally send it
unless
would it work if I used a space character code?
like
0x20?
first of all i'd iterate over the map using java noteList.entrySet().forEach((note, wait) -> { })
and never use Optional::get without ifPresent because on the end, if you removed everything it will throw an exception
Where do I need to put this?
In my code
instead of your for loop
i think using a normal for loop prevents you having a concurrent modification exception so that goes brr too
How do I get the note and the wait?
hello how do i add all online players to a list, and then randlomly select one :3
Random rand = new Random();
Player randomPlayer = Bukkit.getOnlinePlayers().get(rand.nextInt(Bukkit.getOnlinePlayers().size()));```
thank :DDD
public void play() {
Iterator<Map.Entry<Note, Integer>> iterator = noteList.entrySet().iterator();
iterator.forEachRemaining(entry -> {
int wait = entry.getValue();
int totalWait = wait + ticks;
ticks += wait;
iterator.remove();
Bukkit.getScheduler().runTaskLater(() -> {
Bukkit.getOnlinePlayers().forEach(player -> player.playSound /* bla bla bla */);
}, Main.getInstance(), totalwait);
});
}``` I would do something liek this
removing isnt even neccessary if you use ::forEachRemaining
What the hell
i agree
looks weird uhm
hmm ik this is VERY specific how do i get all the online players in a list, select one (randomly), create a variable that contians the random selected player, and remove that random player from the player list
cast online player to an array and get one using a random
Like seriously, just use for (Map.Entry<Note, Integer> x : noteList.entrySet().toArray(new Map.Entry<Note,Integer>[0]))
much nicer
Or just don't modify the underlying array at all
hmm how do i cast online players to a array (im new sorry)
idk why he wants to remove
Or you could also go the iterator route but use while (iter.hasNext())
why not using a linkedhashmap
and remove with iter.remove
too much lambdas
that wouldn't require any lambdas
players = [Bukkit.getOnlinePlayers()];
this is sad help hmm
so why tf is there a org.bukkit.util.Consumer
something like Player[] players = Bukkit.getOnlinePlayers().toArray(new Player[0])
for (Iterator<Note,Integer> iter = noteList.entrySet().iterator(); iter.hasNext(); iter.remove()) {
Note note = iter.next();
int wait = noteList.get(note);
int totalWait = wait + ticks;
ticks = ticks + wait;
noteList.remove(note);
new BukkitRunnable() {
@Override
public void run() {
if (!shouldStop) {
Bukkit.getOnlinePlayers().forEach(player -> {
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 1, note.getPitch());
});
}
}
}.runTaskLater(Main.getInstance(), totalWait);
}
somethign like that
Java 7
put the !shouldstop out of the runnable
Or java 6, idk, either way, it was written when java didn't have a consumer interface
do we not think that should just be yeeted now
oh bruh
likely, but without a deprecation notice it wont happen anytime soon
imagine using the bukkit consumer instead of the java one
Some 10 year old plugins
which are probably dead now
List<Player> p = new ArrayList<>(Bukkit.getOnlinePlayers()),
Player player = p.remove(ThreadLocalRandom.current().nextInt(p.size()));
something like that (it's pseudocode though)
Or anyone that did not bother to change the default compile settings
Though in the end it depends on the IDE and how many JVMs you have set up
List<Player> p = new ArrayList<>(Bukkit.getOnlinePlayers());
player.sendMessage(p);
how send message
?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.
thanks
uhm no pick a player first and then send a message
List<Player> playerList = new ArrayList<>(Bukkit.getOnlinePlayers());
Player player = playerList.remove(ThreadLocalRandom.current().nextInt(p.size()));
player.sendMessage("Message");
For loop
array 👀
that being said, it's pesudocode, did not test it and I won't test it anytime either
based on the previous messages they want to select a random player
Arrays do not have a good #remove operator, as such ArrayList was intended
The previous messages state that the playerlist should have the randomly selected player removed, if they meant kicking then yeah, arrays might be better otherwise no
But context is important, this could very well be an xy problem
oh idk
you forgot a closing } somewhere
oo ok il look :DDD
wha
😳
java.lang.UnsupportedOperationException: Affection not implemented
at self/de.geolykt.sentience.io.WorldInterationManager.showAffection (native Method)
at self/de.geolykt.sentience.io.WorldInterationManager.processInput(WorldInterationManager.java:548285)
at self/de.geolykt.sentience.io.WorldInterationManager.lambda$start$0(WorldInterationManager.java:5486)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
L no affection
is there a library for creating armorstands only 1 player can see
but that I can still see when they interact with the armorstand
Hmm maybe using the hideEntity method?
very dumb question. i want to get all online players in a list/array. select one of those randomly and store it in a variable and remove it from the list (basically it removes one random player from the list of online players and stores it in a value)
is there something in the reverse like hide from all entities but one?
Which list?
Like, the list of all online players that is backed with the actual list of connected players or something else?
i wanna select one of the online players to be a hunter randomly, do some stuff to him, and everyone else tped and stuff
you can make a foreach for all entities and run hideEntity for new entities you need handle for add the hide
what if a player spawns?
that wasnt there before
Okay, that makes much more sense.
So yeah, use the piece of code I have shown you dozen of times before
is thhe plugin logger preferred over the java util logger?
check the event when player join and handle the hide if necesary.. its like the old hidePlayer but works with entities
Yes, why wouldn't it be?
Even if you find hundreds of people using Logger.getLogger("Minecraft") (Why even use that?)
sout 
Paper nags you for using sysout
Yeah, do you know why? 
A really good question
LOL
i saw plugin using the java util logger so i was wondering if it was better or something
I always use sout for testing purposes, and then I use Logger if I actually want my plugin to print debug information or something so Paper will stfu
Yeah same

