#help-development
1 messages · Page 1803 of 1
i doubt there is an easy way
pretty impossible I think
I mean you could probably check if theyre in water
but idk, what are you trying to do actually
definitely possible to do but you'd be editing the server jar to accomplish this properly
can prob do some halfassed way by checking for specific blocks/entities around them
actually I guess even water movement wouldn't work nicely with server jar
forgot all movement is clientside 🙂 working on diff games is weird
how do i get the plugin via the plugin manager again?
getPlugin ?
nice christmas theme btw
How can i build my Plugin with Maven, I only know the variant with build -> artifacts
i meant the full code line... i cant access spigotmc atm
okay correction of my question
how do i do getServer() in a static method
how i add java codes to server
mvn clean install
Bukkit::getServer
Is it possible to extend an existing vanilla mob and call it from within code before spawning the entity?
I just want to spawn a husk that remember Who spawned it :(
Believe spawnEntity method takes a callback which runs before the entity actually gets spawned
Where can I do this?
I don't know that much about maven :D
Terminal presumably or if you use the ui intellij offers
there should be a maven interface on the left side
This is what I see
ui i mean
so i want to make only a certain item drop when i mine a block i know if it was an entity its event.getDrops().clear(); but idk what blocks are on blockbreak event
event.getBlock()
thats intellij. click on the top right part to the right of the hammer symbol
then edit config
event.getBlock().getType().equals(Material.STONE) for example
then the first option to add should be maven
does that stop the normal drop or add a new one
you need to cancel the event
IS this right?
Thanks :)
== not equals 😠
none of both and even the comparison is wrong. this just checks if the block of your event is of type stone
ok
i think i got it working now
nvm didnt work
event.getBlock().getDrops().clear(); i did that
and it changed nothing
BlockBreakEvent
then
if(material.equals(material.GRASS_BLOCK)) {
event.getBlock().getDrops().clear();
block.getLocation().getWorld().dropItem(block.getLocation(), new ItemStack(material.DIAMOND));
}```
Is this right?
declaration: package: org.bukkit.event.block, class: BlockBreakEvent
What you mean with deploying
whats the goal?
hit run
Build the project with maven
It worked but i can't see the target folder
clean install should do it then
if(material == material.GRASS_BLOCK)
i do clean verify and it still works... question, do you already have any methods/a plugin.yml? Because iirc compiling an empty project returns nothing
or just .equals
for me the result ends up in the target folder so i am unsure why it wouldnt work for you
you have to do it in the artifact
never
not on an enum
even the JLS recommends to use == on enums
It returns this error if I build the project
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
shove that into your pom.xml
mnom
could be the start of the file tho
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
i dont know how u got so many errors
with just basic maven
intellij mod dev plugin has templates for that
its the phenomenon of doing something for the first time
i thonk
it can’t be
ironie here btw
bad irony
Ye maven can be confusing sometimes.
:c
intellij is very weird with mavens jdk setting
imagine not using notepad
sometimed
it'll definitely incorrectly think you're using java 5 in first setups
manace to society
despite having a proper jdk value in pom
Pretty sure you can fix that
notepad coder are the alpha males
the editor aint the impressive part
now for the next wave of error as you morph into a pull stack developer
ProjectileHitEvent
thank you 🙂
if(event.getEntity() instanceof Egg egg){
// you can call methods on egg now
}```
lol
btw check if the shooter is a player
what else could shoot=
the Shooter method doesnt exist anymore either way
it checks for insertUUIDhere.dat
do you know where the server stores the day count?
is there an event that can be captured for the breaking of a torch that is attached to a block a player breaks?
WorldNBTStorage.getPlayerData(getUniqueId().toString());
like this i think
as in the player breaks a block with a torch on it and the torch also breaks, i want to capture the torch break event
cuz I dont see it in NBT Explorer of the world file
@EventHandler
public void onHitByFluSword(EntityDamageByEntityEvent e){
if(e.getDamager() instanceof Player){
Player damager = (Player)e.getDamager();
if(damager.getInventory().getItemInMainHand().equals(FluPotion.FLU_SWORD)){
if(e.getEntity() instanceof LivingEntity) {
FluPotion.FLU_POTION_EFFECT.apply((LivingEntity)e.getEntity());
}
}
}
}
someone told me that it would break once the item durability decrease and that I should create a PDC tag for my custom item
how can I do it?
@granite burrowworld.getFullTime() * 86400000L
the spacing in that code is triggering me heh
@Override
public long getFullTime() {
return world.getDayTime();
}
nms killed my last cells
um
String key = "insert key here lol";
NamespacedKey nk = new NamespacedKey(pluginInstance, key.toLowerCase());
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.getPersistentDataContainer().set(nk, PersistentDataType.STRING, "what-u-wanna-put-here");
itemStack.setItemMeta(itemMeta);```
ew, dont create a new NamespacedKey everytime your code runs
since its for intern purpose only and should never change, to detect your NSK's, they should be constants directly instantiated
either way to retrieve it you do:
if(meta.getPersistentDataContainer().has(nk, PersistentDataType.STRING)) {
value = meta.getPersistentDataContainer().get(key, PersistentDataType.STRING);
}```
i see
can you make an example?
is there an event that can be captured for the breaking of a torch that is attached to a block a player breaks? as in the player breaks a block with a torch on it and the torch also breaks, i want to capture the torch break event
I must use PersistentDataType.DOUBLE if i want to store a durability value right?
yes if its a double
I think there is a couple of hanging events could see if they get called when a torch breaks
Never mind entity event
?paste
@pastel stag
https://paste.md-5.net/hujeyufili.java
this will cancel the event
This event should be fired for torches https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockDropItemEvent.html
oh
hmm
nvm its gonna work well
@eternal oxide fired once for the block you break that drops and a second time for the torch that also dies?
use this event as well as the piston thing i listed
yes
read the javadoc on it
sweeeeet this is exactly what i needed thanks homie
should i put my custom item in the pluginInstance parameter?
no
how can i disable block explosion for some blocks
plugin instance is ur plugin instance
declaration: package: org.bukkit.event.block, class: BlockExplodeEvent
do you actually mean block explosion, or blocks being blown up?
private final NamespacedKey arrow_amount_key;
public MyClass(JavaPlugin yourMain) {
arrow_amount_key = new NamespacedKey(yourMain, "arrow-amount");
}
public void addArrowsToQuiver(ItemStack itemStack) {
if(itemStack.getType() == Material.AIR)
return;
ItemMeta meta = itemStack.getItemMeta();
meta.getPersistentDataContainer().set(arrow_amount_key, PersistentDataType.INTEGER, 2);
itemStack.setItemMeta(meta);
}
thats how i would do it
or with a Util class which contains every namespacedkey of your plugin
@EventHandler
public void onExplode(BlockExplodeEvent event) {
Material mat = Material.getMaterial("ur material here in upper case please";
for (Block block : event.blockList().toArray(new Block[event.blockList().size()])){
if(block.getType() == mat)
event.blockList().remove(block);
}
}```@echo hound
with this, the item u specify wont blow up.
you can use blockList().removeAll(ur collection); if u want multiple blocks to not explode
but i would mark creating a new one everytime your code runs as an "ew" in a code-review
I see
thanks for the information cipher
glad to
ItemStack Item = new ItemStack(Material.DIAMOND_AXE, 1);
ItemMeta meta = Item.getItemMeta();
Objects.requireNonNull(meta).setDisplayName("§4Warrior Axe");
List<String> lore = new ArrayList<>();
lore.add("An axe for hero's and warriors");
meta.setLore(lore);
meta.addEnchant(Enchantment.DAMAGE_ALL, 6, true);
meta.addEnchant(Enchantment.DURABILITY, 4, true);
Item.setItemMeta(meta);
return Item;
``` ``` @EventHandler
public static void onRightClick(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
if (event.getItem() != null) {
if (Objects.equals(event.getItem().getItemMeta(), ItemManager.warriorAxe.getItemMeta())) {
Player player = event.getPlayer();
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 200, 0));
}
``` My event doesn't work if the durability from my custom item is changed can someone help me?
why is ur event static
best to avoid it when you can, static makes shit hard while testing
just avoid it
oh yeah that makes sense
learn implicit else btw
tnx
if (Objects.equals(event.getItem().getItemMeta(), ItemManager.warriorAxe.getItemMeta())) {
istn this the same like
item1.isSimilar(item2) ?
also
it doesnt work becuz
ur comparing item meta
and item meta has durability
the item createAxe
has a durability of perfect
after damaging it its not perfect anymore
Use PDCs
aka persistent data containers
String key = "insert-key-here-lol";
NamespacedKey nk = new NamespacedKey(pluginInstance, key.toLowerCase());
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.getPersistentDataContainer().set(nk, PersistentDataType.STRING, "what-u-wanna-put-here");
itemStack.setItemMeta(itemMeta);```
if(meta.getPersistentDataContainer().has(nk, PersistentDataType.STRING)) {
// then the item with the ItemMeta "meta" is your axe.
}```
might be complicated at first but u just learn it, u can ask questions here about it.
btw dont create the namespacedkey everytime ur code runs
what i did here is wrong but works
this is the correct way:
private final NamespacedKey nk;
public MyClass(Plugin mainClass) {
nk = new NamespacedKey(mainClass, "insert-key-here-lol");
}```
then when u make an instance of ur class in ur main class you do MyClass(this)
fun fact i learnt the correct way today by cipher lol
Well i am gonna try to learn it, it's alot of new information i kinda think i should rework my code, so i am gonna finish this project because i also want to look in to hashmaps and cooldowns. But after this project i am defenetly gonna look in to it. it was very helpful tnx.
no problem
for now u can just make ur item unbreakable if u want
so ur code doesnt break when the item is damaged
oh yeah indeed tnx
What should I Declare custom entity Which is extend by vanilla mobs?
I expected like Entity entity = new Entity , but i have no idea what should i do now :(
is it possible to make itemstack.setitemmeta to default to non italic text but still possible to add italics with §o
you mean the lore?
no the name
i saw it somewhere
forgot to upload pic xd
maybe add ChatColor.RESET at the start of setting the display name
looks to be not working
not like that
public class mongodb {
// private MongoCollection players;
private MongoDatabase collection;
private MongoClient client;
public boolean connect(){
try {
client = MongoClients.create("mongodb://localhost:27017");
} catch (Error e) {
//When you end up here, the server the db is running on could not be found!
System.out.println("Could not connect to database!");
e.printStackTrace();
return false;
}
//Get the database called "mcserver"
//If it does not exist it will be created automatically
//once you save something in it
collection = client.getDatabase("Rola");
//Get the collection called "players" in the database "mcserver"
//Equivalent to the table in MySQL, you can store objects in here
// collection.getCollection("players");
return true;
}``` This is my function and why it alwasy return this error?
where then
java: cannot access com.mongodb.ConnectionString class file for com.mongodb.ConnectionString not found
ChatColor.RESET + map.get(...)
Can someone help?
How do I import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack; from spigot-1.18?
Or from where?
I hate maven. (Or any dependency manager.)
If you remember my issue with Files.copy that I kept asking about and no one can figure it out. The cause was maven. I just kept creating new maven projects. Then tried java projects converted to maven etc... After a few days I finally got it to work. No more BS error of the file being open in another process lol.
Can someone help? I can't import PlaceHolderAPI into the Java Maven Project
y
<repositories>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>{VERSION}</version>
<scope>provided</scope>
</dependency>
</dependencies>```
May I have to reload/restart the IDE or project?
reload maven
there is a little maven button
on ur ide screen
screenshot
ur screen
Nevermind, now it seems to work 🙂
No red lines or else
Never used maven before. Seems a little weird tbh
Do you know, if 1.18 spigot still has NMS support?
probably
Afik, there are mappings, but Mr. md_5 highly discourage using nms in plugins
only use NMS if there is no other way of doing it via the API
I'm having some trouble with the Vault API dependency for Maven
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Compilation failure: Compilation failure:
[ERROR] Main.java:[55,26] cannot find symbol
[ERROR] symbol: class Vault
[ERROR] location: package net.milkbowl.vault```
I tried other maven imports for Vault, the main Vault itself, the VaultAPI all kinds it doesn't compile
i must do it inside the method that creates the item?
hey i have found something weird so i have made one thing in my plugin which will allow the players to be able to color every animal name if it have a name so for example: player have named Cow with the name of Cowky and the default name color is &f so white and if he holds a blue dye and right-click on the mob the name will be set &1Cowky so blue which is nice working. But if the player wants to change color of the name on the same animal to other it will not work it just works only once for every mob
and i didn't know why it happens
How should I Declare custom entity Which is extend by vanilla mobs?
I expected like Entity entity = new Entity , but i have no idea what should i do now :(
public class SupremeAxe {
private short maxDur;
private int lostDur;
private int totalDur;
private final NamespacedKey supreme_axe_nk;
public static ItemStack supremeAxe;
public static void initialize(){
createSupremeAxe();
}
private static void createSupremeAxe(){
ItemStack item = new ItemStack(Material.NETHERITE_AXE);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§a§lSupreme Axe");
List<String> lore = new ArrayList<>();
lore.add(0,"§fThe most powerful axe");
lore.add(1,"§ffor the strongest warrior!");
meta.setLore(lore);
meta.addEnchant(Enchantment.DAMAGE_ALL, 7, true);
meta.addEnchant(Enchantment.FIRE_ASPECT, 4, true);
meta.addEnchant(Enchantment.MENDING, 2, true);
}
public SupremeAxe(Plugin myPlugin){
this.supreme_axe_nk = new NamespacedKey(myPlugin,"supreme_axe_durability");
}
public void supremeAxeDurability(ItemStack itemStack){
if(!(itemStack.equals(supremeAxe))){
return;
}
ItemMeta itemMeta = itemStack.getItemMeta();
this.maxDur = itemStack.getType().getMaxDurability();
if(!(itemMeta instanceof Damageable)){
return;
}
this.lostDur = ((Damageable) itemMeta).getDamage();
this.totalDur = (int)maxDur - lostDur;
itemMeta.getPersistentDataContainer().set(supreme_axe_nk, PersistentDataType.INTEGER, totalDur);
}
}
Could someone take a look at my code and tell me if there is anything wrong? It's the first time I create a PDC and I'm kinda struggling with it
You forgot to add the ItemMeta to the item itself at the end of the method
item.setItemMeta(meta);
In 1.18 anyone know what GameProfile and Property was changed to? Or is this just another useful class spigot removed? https://pastebin.com/dwZG6hiW
GameFile and Property is the same in 1.18 still works for me
Spigot cannot remove GameProfile
Make sure to use Maven, if not your imported external jars won't function right
tnks
should the last method be static?
How do I go about cancelling LightningStrikeEvent based on the player who caused it with a trident?
How do I get Maven to obfuscate the new NMS? I compiled mine in Maven but it still shows up as the original wording
I am having problems importing those:
I got everything else to work except gameprofile and property without maven.
Import the Shaded-API and Mojang-Mapped Server one
Hi guys
Add this to your dependency for your pom.xml
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
I have some trouble
Don't we all? xD
I'm not using maven. Got enough issues with it on other resources.
That's why you're having import issues
I made a plugin that like renders a welcome message to the user when they join, but it doesn't seem to work
Cause you're NOT using maven
It does render a message
Or because like I just said... I didn't add the remapped jar to my build path lol
No but even so
I added both jars, the remapped and mojang mapped ones but some imports still won't work
I even got desperate and added ALL the new 1.18 jars still didn't work
Maven is more organised and is much better, painstaking to setup yes, worth it tho
@keen spindle Make sure to register the JoinEvent listener in your Main class too
PDC and events with custom items
@next fossil What repo is this?
It's in the pom.xml file paste it in there
If you are using Maven, that is
If not, go to: BuildTools\Spigot\Spigot-API\target\spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar
and
BuildTools\Spigot\Spigot-Server\target\spigot-1.18-R0.1-SNAPSHOT-remapped-mojang.jar
Import those 2
did you run buildtools with the --remapped flag?
No, as I have written all inside the pom file. Here: https://pastebin.com/VeizrDnL
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.
Maybe I am missing something important?
@echo off
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
set /p Input=Enter the version: || set Input=latest
java -jar BuildTools.jar --generate-source --generate-docs --rev %Input% --remapped```
run buildtools with the remapped flag to generate the jars you need
Wait why are they dependencies? @timid spear
They're external libraries
You're importing them as dependencies. That's why. Put as them external libraries
{
"enabled": true,
"shaped": true,
"outputAmount": 1,
"recipe": [
"GDG",
"TNT",
"GDG"
],
"items": {
"G": {
"item": "minecraft:gold_block"
},
"D": {
"item": "minecraft:diamond_block"
},
"T": {
"item": "minecraft:totem_of_undying
},
"N": {
"item": "minecraft:nether_star
}
}
}
why tis not work
Can you tell me how do I do that?
don;t do any manual imports, let teh maven pom do it all
How? xD
How?
you fill in teh pom and don;t manually import yourself
I'll ask again, have you run BuildTools with the --remapped flag?
if not
?bt
update your pom and the error shoudl vanish
shoudl be an update/reload/refresh button top right somewhere
if intelij
if Eclipse, right click pom -> maven -> update project, then select force update snapshots
I had to restart entire IntelliJ
But now the red text is gone. Nice
Okay, my last issue is this here:
Did it change?
probably net.minecraft.nbt.CompoundTag
Okay, I'll try renaming
you can also just simply remove the import, check where it's used and import manually
I imported the newly CompoundTag
how can i send messages and imageS?
loaded class 0 from 1 which is not a depend soft depend or load before or this plugin spigot
Verify
And make sure you declare your depdencies
ok
wdym and how can i do that
at com.wife.clans.ServerData.connect(ServerData.java:21) ~[WifeClans-1.0.jar:?]
at com.wife.clans.WifeClans.onEnable(WifeClans.java:13) ~[WifeClans-1.0.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-391]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-391]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-391]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[patched_1.17.1.jar:git-Paper-391]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[patched_1.17.1.jar:git-Paper-391]
at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:733) ~[patched_1.17.1.jar:git-Paper-391]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:317) ~[patched_1.17.1.jar:git-Paper-391]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[patched_1.17.1.jar:git-Paper-391]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-391]
at java.lang.Thread.run(Thread.java:831) ~[?:?]
Caused by: java.lang.ClassNotFoundException: com.mongodb.MongoClient
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[patched_1.17.1.jar:git-Paper-391]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[patched_1.17.1.jar:git-Paper-391]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
... 12 more```
MongoClient client;
MongoDatabase database;
private String uri;
public ServerData(String uri){
this.uri = uri;
}
public void connect(){
this.client = new MongoClient(new MongoClientURI(uri));
this.database = client.getDatabase("WifeDB");
}
public MongoCollection<Document> getClanCollection(){
return this.database.getCollection("clans");
}
}```
I have been stuck on this NoClassDefFoundError, I don't know what to do.
public void onEnable(){
serverData = new ServerData("mongodb+srv://");
serverData.connect();
sendConsoleMessage("&a<< Wife clan plugin has been enabled >>");
}```
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.12.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
Here's the pom.xml
What should I Declare new entity That is extend by vanilla mobs?
I expected like Entity entity = new Entity ..... , but i have no idea what should i do now :(
I think you need to shade the mongodb?
Customcrafting?
loaded class 0 from 1 which is not a depend soft depend or load before or this plugin spigot?
Any help with the nbt.CompoundTag ?
I cant set any boolean :/
Hey, i got a question to my world generator. Right now its really laggy and it takes a while to load just one chunk :/
Code:
World world = creator.createWorld();
PlotPopulator populator = new PlotPopulator();
world.getPopulators().add(populator);
static class PlotPopulator extends BlockPopulator {
@Override
public void populate(final World world, final Random random, final Chunk chunk) {
for(int x = 0; x<16; x++)
for(int z = 0; z<16; z++)
for (int y = 1; y < 64; y++)
chunk.getBlock(x, y, z).setType(Material.GRASS_BLOCK, false);
}
I would appreciate your help! 😄
Why are you filling the chunk with a populator
public void onRightClick(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
Player player = event.getPlayer();
if (event.getItem() != null) {
if (Objects.equals(event.getItem().getItemMeta(), ItemManager.warriorAxe.getItemMeta())) {
if (cooldownRight.containsKey(player.getName())){
if(cooldownRight.get(player.getName()) > System.currentTimeMillis());
{
long timeleft = (cooldownRight.get(player.getName()) - System.currentTimeMillis() / 1000);
player.sendMessage(ChatColor.GOLD + "Ability will be ready in " + timeleft + " seconds");
return;
}
}
cooldownRight.put(player.getName(), System.currentTimeMillis()/1000 + 5 );
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 200, 0));
}``` If my cooldown activates it wont go run again it stays in this in my if statement```if (cooldownRight.containsKey(player.getName())){
if(cooldownRight.get(player.getName()) > System.currentTimeMillis());
{
long timeleft = (cooldownRight.get(player.getName()) - System.currentTimeMillis() / 1000);
player.sendMessage(ChatColor.GOLD + "Ability will be ready in " + timeleft + " seconds");
return;``` so in game it will say "ability will be ready in -5 seconds" so i can do the event ones but never again if my cooldown is running
Use pdc
I already sent you a link that shows how to use depend and softdepend
i did it
and its dosent work
hey, i dont know how to do it without a blockpopulator, im new to world generation and im a huge noob 😄
What is pdc and how do I use it?
äh
thx! I'll test it out 😄 Can i ask u if i have any questions?
it's kind of a config where all data about entities, blocks and stuff is saved
just that it's kind of inside the entity/block
the thing that you access ingame with /data
No idea what you are talking about with /data
Pdc is just a wrapper around NBT
I guess you can probably access it with /data then, idk
@young knoll can u add me as a friend on dc, in matter to write you ;D I cant send pictures in this chat
this is where pdc saves it
you can verify yourself
do i need a spigotmc acc for this?
I'd say that its an api for persistent data storage based on entity/item nbt tags 🤓
nbt is a format
yep
It’s literally a wrapper around NBT tags
ok true
its just spigot's api for nbt
I mean the link has a full guide
?pdc
May I ask someone of you for help in implementing this.
If you can, please message me directly
how can i loop through all blocks around a player
Players is going to be a list in a document, would querying it like this work?
public boolean isInClan(){
Document query = serverData.getClanCollection().find(eq("Players", uuid)).first();
if(query != null){
return true;
}
return false;
}
can you help??
what's the problem?
.
but i fix this now i hade this:
perhaps you need to shade the mongodb.
public class mongodb {
// private MongoCollection players;
private MongoDatabase collection;
private MongoClient client;
public boolean connect(){
try {
MongoClientURI connectionString = new MongoClientURI("mongodb://localhost:27017/?readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false");
MongoClient mongoClient = new MongoClient(connectionString);
} catch (Error e) {
//When you end up here, the server the db is running on could not be found!
System.out.println("Could not connect to database!");
e.printStackTrace();
return false;
}
//Get the database called "mcserver"
//If it does not exist it will be created automatically
//once you save something in it
collection = client.getDatabase("Rola");
// MongoCollection<Document> collection = collection.getCollection("test");
//Get the collection called "players" in the database "mcserver"
//Equivalent to the table in MySQL, you can store objects in here
// collection.getCollection("players");
return true;
}```
have you shade it?
you're getting CNF exception right?
Im using db on lockal host
doesn't matter
your plugin still doesn't recognized what is MongoDatabase after compiled
because the class isn't exist on the plugin
as i told you 3 times, you need to shade the mongodb
take a look here https://www.spigotmc.org/threads/mongodb-with-maven.262129/
How do I get a JSONObject from query, doing JSONObject jsonObject = new JSONObject(query.toJson()) does not work.
looks like the normal org.json json library to me
Imagine using org.json
or no?
is that what its called?
i just knew it as json tbh
That special moment when you realized spigot comes compiled with gson
oh that obsolete one
No, but vanilla do
Yeah, spigot don’t have it, but vanilla do
My BurchAPI lib uses Gson and doesnt actually import it, it just borrows spigots
https://github.com/stleary/JSON-java im thinkin of this @ivory sleet
And spigot import vanilla
honestly yeah id just use gson since its provided
not to mention it has amazing serialization/deserialization
?
Hmmm do you use intellj + its minecraft development plugin?
If you do then you can tick both spigot + bungeecord box
and you need 2 diff classes, one class extending JavaPlugin, another class extending Proxy of whatever Bungeecord extends
use bungee.yml as your plugin manifest for bungee, plugin.yml as your plugin manifest for spigot, then make sure no bungee classes import spigot stuff and vice versa for the spigot classes of yours
Wait jar is basically a zip file, then do it compress the size of the files?
Like zip?
does the class exist?
yes
i almost want to say yes because you can unzip and re-zip a jar
hmmm
you reload the server or restart for load the plugin?
restart
medic..
hm?
i should play tf2
hmm try check the JAR if has the .class for this PlayerBlockPlaceEventListener
if this class is not then try rebuild the plugin
and the orbrpg?
such an ugly logo
thats fine
idk how to change the package name tho
tried rebuilding
depend of IDE...
hm?
in intelliJ i use CTRL+R in the package for rename
i did rename the package in intellij tho
it shows events
in the ide
but in the jar it shows Events
hmmm can you show this in the IDE?
cant upload images
but it is
orbrpg>events>player>PlayerBlockPlaceEventListener
in the ide
but orbrpg>Events>player>PlayerBlockPlaceEventListener in the jar
!verify
Usage: !verify <forums username>
Verify when?
does PreLoginEvent still get called if the player gets kicked for whitelist?
also does it trigger with invalid session kick? i assume no, but still asking
I'm having a strange issue with a project since updating. One of the classes is showing errors, one being not being able to import or.bukkit.Material but in other classes it is fine. The whole class object is showing an error "cannot access Object" saying "bad class file Object.class" everything compiles and build correctly and the code that is in that class is being executed.
There is an event for when a player adds an item to his 2nd hand?
maybe use inventory change and just track what is in the slot, if new item isn't old item, it changed
Its not mc1.18, its java-17. Something has changed?
Hey, i got a question to my world generator. Right now its really laggy and it takes a while to load just one chunk :/
I would like to do it using ChunkData but i dont know how :/ A piece of code would be really helpful!
Code:
World world = creator.createWorld();
PlotPopulator populator = new PlotPopulator();
world.getPopulators().add(populator);
static class PlotPopulator extends BlockPopulator {
@Override
public void populate(final World world, final Random random, final Chunk chunk) {
for(int x = 0; x<16; x++)
for(int z = 0; z<16; z++)
for (int y = 1; y < 64; y++)
chunk.getBlock(x, y, z).setType(Material.GRASS_BLOCK, false);
}
I would appreciate your help! 😄
threadding it would help
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
//code
},2};
@patent wadi whats ur IDE
if ur on intellij id try invalidate caches and restart
netbeans
nb has the same which I have done, if i switch to 15 or 16 its fine
hmm
something could have changed or I haven't got the platform set up right perhaps
I'm using the boxed version (zip) which I just added as a platform. I installed it systemwide but for some reason NB isn't seeing them but thats not unusual
hmm
Nice name
set a custom name of "" and make visible
That just work on customName
doesnt work
try making it " " so there is something there and not empty, and you could try RGB and make the alpha transparent
Hey, I have a problem with my Worldgeneration but i dont know, how to apply my ChunkData
public void createPlotworld(String displayName) {
WorldCreator creator = new WorldCreator(name);
World world = creator.createWorld();
// generating chunks using generateChunkData(world, null, 0, 0); but idk how lol
}
public ChunkData generateChunkDate(World world, Random random, int ChunkX, int ChunkZ) {
ChunkData data = createChunkData(world);
for(int x = 0; x <16; x++)
for(int z = 0; z <16; z++) {
data.setBlock(x, 100, z, Material.AMETHYST_BLOCK);
}
return data;
}```
I appreciate your help 😄
what version
Just make a team with scoreboard and set option NAME_TAG_VISIBLITY
thats sorta what I've been saying
1.17.1
@pastel mauve
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/generator/ChunkGenerator.html
there is no "generateChunkDate"
declaration: package: org.bukkit.generator, class: ChunkGenerator
i believe this changed in 1.17 already
oh right, how do you view the api for an older version?
generateChunkDate is my own method to create the chunkdata
ok, and now you want what ?
i want to know, how to apply the chunkdata to the chunks in my world
i guess you need to check out the methods from the link i send you and apply the data out of the ChunkData there
could be easier to generate the World with the provided Methods instead
yeah but how can i add my plots and the default height levels to this world?
ok yeah idk i just set my jdk and what not to J17 in my IDE and it worked just fine @patent wadi
might be a netbeans issue
when should i use configuration files and when a database to permanently store per player data? Or can I attach data to players directly?
you can attach data to a player directly by editing their PersistentDataContainer
?paste
https://paste.md-5.net/hatitegehi.java So ive tried this with all of the Team.OptionStatus and it doesnt work for any of them. any ideas? im trying to make the players name invisible and this is the entire plugin so far.
everything runs but the names just wont become invisible
boo
would it be possible to have a folder with java classes in the server folder, that could be used by the plugin
so the user could edit the java classes without having to edit the plugin itself
just because you dont want to edit the plugin ?
dont think this will work (easy)
That’s what configuration is for
You’d have to jump through a lot of hoops to compile Java at runtime
it was more so that users could add custom java stuff without having to do all the trouble of compileing
Why not use configs?
because then i would have to hard code all the stuff in
what can users change ?
like so maybe a player could make a sword teleport someone 2 blocks forward get their angle summon a custom armor stand 10 blocks forward and make it explode
Aren’t you basically asking users to edit your plugin for you at that point then?
Do you think your users know how to write Java?
Better yet, why not make it an API and allow other devs to expand on it?
that is a great idea, ill have to look into that
actually, I'd recommend making very general functions that can take and digest a lot of parameters, just do it in a sensible way (speak, do the opposite of yanderedev), then allow the creation of action sequences
also configs can be manipulated fairly easily. They would be a good idea for what you're planing
on another tangent what's the maximum amount of data you can fit into a players PersistentDataContainer ?
so something like a program that can take some things and make a item file out of it and then a plugin that can read understand and translate those things into java code?
ah no. I meant writing the code but in a way that it can do the stuff you want, given the right parameters. Runtime compiliation may be possible in java, but its definitively a very bodge-y story in minecraft
i more want it to be like all those custom item plugins (aka uberitems) because i think i can do it much better and those there already are there suck and i dont like thirtyvirus
thats kind of what those plugins do. You have a function that can generate it and tell the plugin when to run that code, depending on what the player does
yes
cant tell you much more
also can someone PLEASE tell me how to properly import bukkit javadoc into intellij?! I'm only getting the method signatures
are you using spigot or spigot-api ?
yes
should work fine then
hi, since 1.18 update I can't compile my new module. Should I import every lib one by one? It was working on 1.17
question about skins. Does notchian minecraft client require Mojang generated signature key to render the skin properly?
running 'download sources and documentation' did not change anything
if there is no javadoc?
there is
anyone?
i did import the spigot-1.18-javadoc in the context menu
yes
isnt signature optional
skulls work fine without, but players require a valid signature
how can I make entities spawned in with packets respawn when a player goes too far and then comes back?
Hey Guys
I programmed a one way Elytra Plugin for 1.18. It works perfect. But only on my local server...
If i try to run the plugin on my public server, which I'm hosting with Ramshard, it dowsn't work properly. To test if the Plugin even gets loaded I coded a Message which replys "test" in the console when the Plugin is loaded. This works on both server but the rest of the Plugin only works on my local Server
This is the code:
package lenotex.onewayelytra;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityToggleGlideEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
import java.util.List;
public class OneWayElytra implements Listener {
private final int radius;
private final int boost;
private final List<Player> flying = new ArrayList<>();
private final List<Player> boosted = new ArrayList<>();
public OneWayElytra(Plugin plugin){
this.radius = plugin.getConfig().getInt("radius");
this.boost = plugin.getConfig().getInt("boost");
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
Bukkit.getWorld("world").getPlayers().forEach(player -> {
if(player.getGameMode() != GameMode.SURVIVAL) return;
player.setAllowFlight(isInSpawnRadius(player));
if(flying.contains(player) && !player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType().isAir()){
player.setAllowFlight(false);
player.setGliding(false);
boosted.remove(player);
Bukkit.getScheduler().runTaskLater(plugin, () -> {
flying.remove(player);
}, 5);
}
});
},0,3);
}
@EventHandler
public void onPlayerToggleFlight(PlayerToggleFlightEvent event){
if(event.getPlayer().getGameMode() != GameMode.SURVIVAL) return;
if(!isInSpawnRadius(event.getPlayer())) return;
event.getPlayer().sendMessage("Elytra");
event.setCancelled(true);
event.getPlayer().setGliding(true);
flying.add(event.getPlayer());
}
@EventHandler
public void onDamage(EntityDamageEvent event){
if(event.getEntityType() == EntityType.PLAYER && (event.getCause() == EntityDamageEvent.DamageCause.FALL || event.getCause() == EntityDamageEvent.DamageCause.FLY_INTO_WALL) && flying.contains(event.getEntity()))
event.setCancelled(true);
}
@EventHandler
public void onSwapHandItems(PlayerSwapHandItemsEvent event){
if(boosted.contains(event.getPlayer()) || !event.getPlayer().isGliding())
return;
event.setCancelled(true);
boosted.add(event.getPlayer());
event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().multiply(boost));
}
@EventHandler
public void onEntityToggleGlide(EntityToggleGlideEvent event){
if(event.getEntityType() == EntityType.PLAYER && flying.contains(event.getEntity()))
event.setCancelled(true);
}
private boolean isInSpawnRadius(Player player){
if(!player.getWorld().getName().equals("world")) return false;
return player.getWorld().getSpawnLocation().distance(player.getLocation()) <= radius;
}
}
repeating task is the way to go i think
it would just keep spawning them
can i detect if the client can see an entity with a certain id
when did they add persistent data? what minecraft version is the earliest that uses it?
it says 2017
1.14 iirc
ok thanks
1.13 actually but in 1.14 its name got changed
dump
You’ll need to depend on brigadier and authlib separately
i made my jar file into a exe
with launch4j
but i keep getting
no main manifest attribute, in C:\Users\pcc\Desktop\my app name
Can someone help me with this
wdym
for everyone or just for your uses ?
my uses
no
mk
you cant modify code from the api
if you extend the class
you would need to extend CraftPlayer but this is awful
public class PlayerExtension extends CraftPlayer {
@Override
String getName() {
return "meh";
}
}```
craftplayer i dunno
just an example
okay but will i be able to access that from Player
_<
k
you will be able to access player method from your class
Player is just an interface.... if you extend CraftPlayer and somehow overwrite everything in the API that stored the old player-object you would get your player object but you have to cast it to your customplayerobject every time
okay
but why the hell is this an option that you wanne use 😄
can't you create create a wrapper class?
which stores an player's uuid
not the actual player :kek:
jar into an exe brr run
isnt there something you need to create so java knows where your main class is with your public static void main(String[] string)
wait thats right
i think it was the manifest
i thought only dotnet uses .exe extensions
how to do it tho
public static void main(String[] args) {
// main entry point of your program
System.out.println("started!");
}```
create MANIFEST.MF inside META-INF
write down:
Manifest-Version: 1.0
Main-Class: path-like-spigot-wants
i dunno where that is going to be printed but yea 😄
where tf is meta inf
if you just use a ide?
should have used gradle
gradle vs maven for spigot plugin development?
maven 🪕
gradle
why though
faster
you mean for compilation?
yes
ah
wait
blueJ :kek:
I DONT HAVE META INF AT ALL
maven needs 6s .... thats fast enought
😭
just add it ?
im creating a /vanish command. is there any way that i can fake disconnect a player? that the message player disconnectet is comming?
when gradle needs only 1s
hide the player and send a quit message
how can i send a quit message?
find out where the PlayerQuitEvent runs in nms and copy the part where a msg is send to everyone
maven multi modules 🤡
hopefully never had a multimodule maven project
yuh
hmm just got into maven ... i will not try to figure out how gradle will work xD
Bukkit.broadcastMessage()
smh how do i set a github repo public?
ah found it
what's wrong with multi module?
multi module maven saved my life when 1.18 came out
@ivory sleet
not really. it takes ages for the initial setup. when I'm cloning a gradle project, gradle is still doing things after 5 minutes, while with maven, I would have already been done meanwhile lol
and then i made something like this
If you have a map as a yaml value (for example):
keyset:
key: value
key1: value1
anotherkeyset:
key: value
key1: value1
You can obviously get that as a YamlConfiguration. The only method I found that seems to be able to deal with this is YamlConfiguration#getMapList which returns a List<Map<String, ?>>.
- Is that the right method?
- How would you convert that to a
Hashtable? Why is it a list of maps rather than a single map? I've never usedMapin java before - is it a single key value pair or multiple, or is it the same as aHashtable- what's the difference?
maven is totally fine. stick to it unless you have actual reasons to switch. I'm meanwhile using both but I also prefer maven
uhh what is a hashtable
what are you actually trying to do? Do you want to convert it to a map like
keyset.key -> value
keyset.key1 -> value1
...
?
yeah
its unbearable with maven ngl
whats wrong with a map?
I've never used them xD - are they literally just a set of key value pairs?
yessss
You can do sth like this:
Hashtable<String,Object> map = new Hashtable();
for(String key : yourYamlConfig.getKeys(true)) {
map.put(key.yourYamlConfig.get(key));
}
gradle is faster in compilation which is helpful when testing for me
Ig Hashmap, Hashtable, and map are all similar things with different implementationx
might be true but the initial setup takes waaaay longer in gradle
Conclure do you know how to properly add javadoc to intelliJ? Nobody's been given me useful answers all day
Hash table based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key. (The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.) This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.
whoa the bible
damn i tried cloning advneture
and it installed me a dozen of gradle plugin
s
well if project is complex it would take time
using gradle?
What's AutoCreate.exe
maven
my app
thing is
idk about maven sry
shouldnt java.jar just work as runnable ?
this has nothing to do with maven sir
everything i tried including what the intellij website says just gives me the method signautres
i want the frigging docs
i want to know more than where the method is declared
wasnt talking to u
also i think its some dumb intelliJ thing not a maven one
i could be wrong on that one tho
Try:
Maven sidebar (top right) -> Project Name -> Dependencies -> Spigotmc (right click) -> Whatever you want
Yeah that works for me
Then (for example) you can view the source with this button
my .gradle folder takes 5,1 GB 😎
Hello, is anyone familiar with Maven, and the whole remapping thing?
I'm kind of stuck
The "renaming" of Minecraft's code so it is no longer obfuscated
I'm not 100% sure what you mean, but here's my gradle config for fabric dev:
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
gradlePluginPortal()
}
}
(if that helps)
Try a few times it's weird
Im not familliar with remapping but if you're about mojang mappings just use specialsource
ExCUUUUSE me??? wth is now included in the docs and what not?
also i do not have done anything to get the actual javadoc into that project
so im a bit curious how its working at all
I'm using it, and the code compiles, but on runtime, the server doesn't recognize my methods, so I need to reobfuscate my code or not deobfuscate at all
that thing is really weird
And I don't know how to do either of that
Show your pom
go to the super.onEnable()
i think it'll show up there
Take a look at the thread
The pom is posted there
how do i go there? super.enable() in code just gives an error
ctrl click on your onenable
The code snippet is not mojang mappings....
ah didnt work but its this
'no usages found in project files'
Plugin.class
??
it overrides the method from its super class
yes but
my version has no javadoc in it
yours does
what the actual fucks going on here
C:\Users\pcc\Desktop\pmmp>java -jar AutoM-1.0-SNAPSHOT.jar
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/kwhat/jnat
ivehook/keyboard/NativeKeyListener
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.github.kwhat.jnativehook.keyboa
rd.NativeKeyListener
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more```
in which class are you?
help
JavaPlugin.class
go further
PacketPlayOutChat is not Spigot mappings, on mojang its ClientboundPlayChat or smrh
check the class it extends
and then one more
no javadoc either
there's just a bunch of I's on the left that tells me where its implemented
I'm in Plugin.class rn
Well where is it from then))
i dunno why this one is in comments and this one doesnt seem to
yea mines just empty void there
ofc there's no javadoc to show when there's no javadoc to begin with
but the javadoc for JAVA stuff is there
thats why the .log message shows its javadoc
How do I check the region where the player broke the block with the worldguard API
I've got one more idea and if that doesnt work ill just go die
OH COME ON
I'm done
Ill try again tomorrow but i got enough for today
gradle :3
🙏
Hey why can't I
import Bukkit.***
With the spigot 1.18 library?
not promising it will work with gradle but at least I know how it should be done with gradle lol
well thats an invalid import
if it should ignore already discovered ones
I meant Bukkit.anything
yuh
send the code (the entire class)
(use a proper build tool)
jupiter those are not loading for me
LoL
the keys :/
I used to be able to post plugin reviews but I noticed on October 16 all of my reviews were deleted and I couldn't make reviews. I sent a support email but never got a response so I'm here now looking for help.
but this is the wrong channel i guess
Where can I ask for help on it ?
My code:
import org.bukkit.Bukkit;
"Cannot resolve symbol 'Bukkit'"
But I added the spigot 1.18 jar to the libraries
Can someone help me?
I just try to import Bukkit with the spigot-1.18.jar in the libraries but it isn't working
Maybe message one of the forum staff?
?paste
@rancid hare use this^
create a thread at spigot or smth idk.... but its not a development question
okok
Cannot resolve symbol 'Bukkit'
What ide are you using?
reading the release thread on the forums for 1.18 might help
?
the server is now a bundler
What?
the libraries are not inside of it as classfiles but rather the plain jars
yea read the forum post
Can you give me the link? :/
hehe christmas
just run the server 1.18 one time and then import all libs in the new bundler-dir
Oh ok
maven is nice :)
https://prnt.sc/21llg0d so should I just add all those libraries?
Idk I would have to use ProtocolLib for packets
Gradle is nicer 😀
Ok thank you!
the forum post you just "read" also goes over how to use NMS
use a proper build tool
use a proper build tool
maven would be easier but i understand you
Hmmm
im pretty sure maven would be easier only because you can ignore everything and just copy paste
How would I get the location of a block then display it on the Scorebord R4 plugin?
Basically, the distance from that block
I know that, however how do I show it on a scoreboard
Why do you use #
it's a class method
Intellij says that's not real code
To not mess non static methods with static ones
i believe so
Ah, fair enough. I've never seen that outside this Discord.
true^ I'm just trying to find a way to show it on a scoreboard
honestly i just do foo.bar() for non static and Foo.bar() for static
That's your preference 🤷♂️
No Idea, I have never made or used a scoreboard
google is your best friend
Google brought me here
uhh :kek:
I originally just took a Scoreboard plugin, then added the line ```js
Location#distance(0,64,0)
So now I'm here 😄
maybe this is something?
https://www.spigotmc.org/wiki/making-scoreboard-with-teams-no-flicker/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
mwoa in syntax
Yes c# is a java clone
...
it has many stuff java doesnt have
Shut up 🙂
that's just microsoft
Microsoft didnt liked that java was able to run on every platform so they made an alternative that works on Windows only
nothing but "microsoft java"
they have linq 
I looked through this, however it doesn't seem to be what I'm looking for 😪
what are you looking for?
I don't need scoreboard teams, I just want to display the distance from a block
Wdym?
start with creating a scoreboard
I already did
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/kwhat/jnativehook/NativeHookException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632) Caused by: java.lang.ClassNotFoundException: com.github.kwhat.jnativehook.NativeHookException at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 7 more
help
You're missing a dependency. Either something is in a too old version, or you just don't have the dependency when you're running
?
I already have, like stated before I just need to know how to display the distance to a specfic block on that scroeboard
i just built path maually
Pro tip who are messing with packets. If you want to send packet in order, instead of delaying the code execution via scheduler use built in method in PlayerConnection in which you can provide FutureListener
connection.a(new PacketPlayOutNamedEntitySpawn(spawnSerializer), future -> connection.sendPacket(PacketPlayerEntity.this.infoRemovePacket));```
for example *(this snippet sets the skin of player NPC. And in order to hide the player from tablist you need to delay the remove info packet)* by utilising this, you're executing this as soon as the packet was sent, rather than guessing that at that provided time packet probably was received.
Idk. if you're using maven, then you can shade dependencies into your plugin. Might help in this case, but it's hard for me to know
Objective#getScore(string)
i built it manually i dont use dependencies with maven
Oki, don't know then
does anyone got the new mappings for java.lang.ClassNotFoundException: net.minecraft.v1_18_R1.nbt.NBTTagCompound?
Woah qool!
Hey guys so i have one player interact at entity event and i made only to interact on the OFF_HAND so i made event.gethand() == EquipmentSlot.OFF_HAND but it's not firing in the off_hand which is very strange
and i don't know why it cannot be fired in the OFF_HAND it fires fine in the MAIN_HAND
this could sound strange
but do you have any protocol hacking plugins (viaversion, viabackwards, viarewind) on your server?
it could be that these plugins are messing with player's protocol packets before it gets to bukkit event api
@mortal hare i have only viaversion
can you try removing that plugin for a bit
and see if that's the problem
but i doubt it is
alright i will remove it right now
im a chad
i dont use mappings
because im too lazy to setup it
and im fine researching the nms by myself 😄
you are ill
@mortal hare same thing without via version
is there some other way to check if player hand is off_hand
What do you mean by read
please guys does someone here know how to check if hand is OFF_HAND without event.getHand() cuz it's not working for some reason on OFF_HAND
thsts not possible
but why then event.gethand() is not working for OFF_HAND
Hey, i got a little problem with my ChunkGenerator. After I restart the Server, the ChunkGenerator won't exist anymore. My question is how to add the ChunkGenerator again to a world.
Code:
WorldCreator creator = new WorldCreator(name);
creator.generateStructures(false)
.type(WorldType.FLAT);
ChunkGenerator chunkGen = new CustomGenerator();
creator.generator(chunkGen);
World world = creator.createWorld();
hmmmm for a very weird reason the event is working for other entites but it's not working for armorstand which is very strange
like i can fire for armorstands only with the MainHand
Does anyone know how I can display ```js
Location.distance(0, 64, 0)
On a scoreboard
I want to show the distance from spawn on a scoreboard
@next fossil
Yeah
let me know once you changed 1.17 to 1.18 everywhere in your pom
Ok
Is there a way to generate the loot table of a mob with it's type instead of an entityDeathEvent ?
do you know how to get the loot table in the event?
I dont have an event
if yes, let me know how, and I'll check the NMS to see if you can also do so in NMS without the event
yeah I know
ah
Could you elaborate...?
ev.getDrops() ig
from EntityDeathEvent, right?
yes
alrighty lemme check
