#help-development
1 messages Ā· Page 1416 of 1
Ask here instead lol https://www.spigotmc.org/forums/skript.90/
i have to start somewhere
lol
It's fine, you didn't annoy us.
annoyed me
ikr
In what event?
blockbreak
It'd just be whatever is in the players main hand.
maybe ```on break:
if block is (block)
like that
so it would be?
event.getPlayer().getInventory().getItemInMainHand().containsEnchantment(Enchantment.SILK_TOUCH)
Sure, buut remember to check iteminmainhand is not null or air
empty hand can be AIR or null
Not sure, old habit let me check docs
Hmm just check if containEnchantment works on air if so you don't have to do any checks.
?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.
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.
spam
Okay
declaration: package: org.bukkit.event.world, class: LootGenerateEvent
that one srty
nope it doesnt work... by best guess is if(event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.AIR))?
No one
other than you
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
^^^^^^^^^^^^^
I gave you the link
how do i use a config in another class
var mainHand = event.getPlayer().getInventory().getItemInMainHand();
if (mainHand.getType() != Material.AIR && main.containEnchantment(Enchantment.SILK_TOUCH)){
// Shocker
}
Hey, sorry if I'm disturbing but I don't understand how to do a multi module project using maven for minecraft plugins :/
I do not understand how to say which module to choose depending on the version etc ...
Do you have any link to help me ? (Tuto or whatever)
wdym ?
Aids. No one is going to make a plugin for free to you
@worldly ingot This guy keeps asking for services in dev
I can code it for you. It will only cost you $1000
Obviously yes, why ?
Whut, wrong one
You guys see why I wanted to leave
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
this is his "serious" mode
and if you're continuing to ignore that message I'll happily kick you
We have forums for a reason
I don't do mods sorry
?resources
We're not going to encourage unfair advantages in this Discord, it's against Mojang's ToS
?kick @quaint mantle
š¢ Kicked aids#1534
o
Your allowed to get help about dev
Nothing more
Thank you
Imma be honest. from the second I saw him here I realised that he would get kicked
Don't continue to talk about him.
Never
Well, let's talk about something else
Does anyone knows tutorials to do a multi module project using maven for minecraft plugins :/
I do not understand how to say which module to choose depending on the version etc ...
Do you have any link to help me ? (Tuto or whatever)
(Pleaaaase)
It's just a standard multimodule project
š¤
Make a "common" implementation inferface or whatever and multiple submodules that implement them for each version.
Didn't find this, thank you
Wait cant I just get the drops on a blockbreak evnet?
yep
Tbh that's my first time using Maven x:
Thank you for these informations
So I dont even need to get these silk touch checks cuz minecraft already does that for me
No you can't, but you can get the drops from the block break (.getBlock().getDrops() i think)
No, thats in the BlockDropEvent
Oh my bad, yeah.
saw this and thought sure https://i.imgur.com/ixQPq5O.png
Just do .getBlock().getDrops(event.getPlayer().getItemInMainHand())
drops depend on whats used to break the block
LUCK, FORTUNE, SILK_TOUCH etc
yeah so I dont need to check for em myself
Probably not
how can I remove the dropped items tho
how do i access a config from another class
setCancelled?
configs are global
nah
yes, and set teh block to air
setDropItems( boolean)
you jsut need to get an instance
declaration: package: org.bukkit.event.block, class: BlockBreakEvent
wdym by that
I have a feeling setting the drops to false will not be 100% accurate
im using blockdropevent rn since it considers fortune and stuff aswell
so i can just do plugin.getConfig();
u need to get a instance
just cancel it then
if ur not on the main class
StatApi plugin;
@EventHandler
public void armor(PlayerInteractEvent event) {
for(Player p : Bukkit.getOnlinePlayers()){
UUID uuid = p.getUniqueId();
ItemStack helmet = p.getEquipment().getHelmet();
ItemStack chestplate = p.getEquipment().getChestplate();
ItemStack leggings = p.getEquipment().getLeggings();
ItemStack boots = p.getEquipment().getBoots();
plugin.getConfig().addDefault(uuid + ".helmet", helmet);
plugin.getConfig().addDefault(uuid + ".chestplate", chestplate);
plugin.getConfig().saveConfig();
}
}```
nully
wait how can I give the player a collection?
it says event.getBlock().getDrops(); is a collection
addItems
declaration: package: org.bukkit.inventory, interface: Inventory
I suppose
there is addItem
but when I try to add that
it says Cannot resolve method 'addItem(java.util.Collection)'
Yeah .toArray(new ItemStack[0])
Main plugin = JavaPlugin.getPlugin(Main.class);
Cannot resolve method 'addItem(java.lang.Object[])'
Does anyone know how I would get the Location where the egg lands and then create an explosion there? https://imgur.com/a/ZmURf01
this is what I have java public void autoPickup(BlockDropItemEvent event) { Collection dropped = event.getBlock().getDrops(); event.setCancelled(true); event.getPlayer().getInventory().addItem(dropped.toArray(new ItemStack[0])); }
Did you do new ItemStack? if so just cast it to itemstack array
and ignore the warning with unchecked cast
https://paste.ubuntu.com/p/XhMTqtvxCh/ ```java
public class onPlayerJoin implements Listener {
private static HashMap<Location, Boolean> spawnLocations;
public onPlayerJoin() {
Location seat1 = new Location(Bukkit.getWorld("Dungeons1.1"), 120, 100, -65);
Location seat2 = new Location(Bukkit.getWorld("Dungeons1.1"), 120, 100, -65);
Location seat3 = new Location(Bukkit.getWorld("Dungeons1.1"), 120, 100, -65);
Location seat4 = new Location(Bukkit.getWorld("Dungeons1.1"), 120, 100, -65);
this.spawnLocations = new HashMap<Location, Boolean>() {{
put(seat1, false);
put(seat2, false);
put(seat3, false);
put(seat4, false);
}};
}
@EventHandler
public static void onPlayerJoinEvent(PlayerJoinEvent event) {
Player player = event.getPlayer();
player.teleport(getAvailableSpawnLocation(player)); // <----- this is actually line 47 from the traceback
}
private static Location getAvailableSpawnLocation(Player player) {
System.out.println("Reading entries...");
for(Map.Entry<Location, Boolean> entry : spawnLocations.entrySet()) {
if(entry.getValue().equals(false)) {
entry.setValue(true);
return entry.getKey();
} else {
System.out.println("Not False: " + entry.getValue());
}
}
System.out.println("Finished reading entries...");
return null;
}
}
what kinda sorcery is this
Could also just do dropped.forEach(event.getPlayer().getInventory::addItem)
ProjectileHitEvent event.getEntity().getLocation()
or something
I have that though? createExplosion requires a coordinate parameter though and I don't know how to getLocation from there
it says it needs Consumer but we provide a hashmap?
How and why would BukkitRunnable#getTaskId return null when its return type is Integer? Docs state it returns the task ID, or throws IllegalStateException. Nothing is mentioned about it returning null.
you get the Location from teh entity
ight changed to this seems to not give any errors java public void autoPickup(BlockBreakEvent event) { ItemStack dropped = (ItemStack) event.getBlock().getDrops(); event.setDropItems(false); event.getPlayer().getInventory().addItem(dropped); } }
Ehh nah
?
public void autoPickup(BlockBreakEvent event) {
ItemStack[] dropped = (ItemStack[]) event.getBlock().getDrops().toArray(new ItemStack[0]);
event.setDropItems(false);
event.getPlayer().getInventory().addItem(dropped);
}
}
Can you give me the line of code I would use to do that? There's a requird coords in createExplosion
createExplosion takes a Location
I think there might be legacy int int int Elgar?
ah, then sorry not helping. Update to 1.16
No like a legacy function
He needs to use teh one that accepts Location then
the location in createExplosion needs to get where the egg was thrown
yes, I already said twice. event.getEntity().getLocation() in the ProjectileHitEvent
If you want any kills to be attributed to the player who threw the egg, you getShooter() on the projectile and use the createExplosion method that takes a source entity
Yeah I got it, thanks!
fortune doesnt seem to work
:/
eh ig ill just not add autopickup
That's a bug then
why am i gettting their error
report it to spigot jira
Could not pass event PlayerInteractEvent to Statapi v1.0-SNAPSHOT org.bukkit.event.EventException: null
how
Full error
No clue, tag @worldly ingot and hope for the best Block#getDrops(ItemStack) no like fortune
@worldly ingot
?paste
wrong channel
bump
Api.java:33
plugin.getConfig().addDefault(uuid + ".helmet", helmet);
is it not getting the helmet from the player
ItemStack helmet = p.getEquipment().getHelmet();
oh wait
configs can't have itemstacks
I've seen no stacktrace from you, nor an actual question
its in the link...
at net.neednot.listeners.Api.armor(Api.java:33) ~[?:?]
how is that causing a npe? im so confused
hoping for the best does not seem like a good solution :p
?jira
lol
did ya leave a stack trace
Block#getDrops(ItemStack) no like enchants
yes this is the fixed version
why would this be causing the npe
plugin.getConfig().addDefault(uuid + ".helmet", helmet);
You are creating the locations on class creation (in the constructor). If that is ran too early there will be no worlds so your Bukkit.getWorld will fail and your map will never be filled.
try/catch your constructor code
depends when you defined your class
well here java @Override public void onEnable() { /* Import Events */ getServer().getPluginManager().registerEvents(new onPlayerJoin(), this); // logic }
alright ty
oh, also delay your telport. tp in the onJoin usually will not work.
oh wow alr tx
camel?
thisTypeOfText
idk I personally like underscores but every tutorial I see uses camelcase
is it possible to disable the server.properties in the server root folder and just take the one in the spigot.jar
???
perhaps java doesn't support them or maybe people dont like them
camel for methods
yeah no it wasnt spigot :/
public void autoPickup(BlockBreakEvent event) {
Player player = event.getPlayer();
ItemStack[] dropped = (ItemStack[]) event.getBlock().getDrops(player.getItemInHand(), player).toArray(new ItemStack[0]);
event.setDropItems(false);
event.getPlayer().getInventory().addItem(dropped);
how do I check if a player was hit from the back so they take bonus damage
getDamager and check their location in relation to the Player and the players direction
This isn't working for some reason
https://paste.md-5.net/itutapekin.java this is the error https://paste.md-5.net/ejivuyeruj.cs
so get damage then check the player that did the damage' location then see what direction the player hwo took the damage is facing?
kind of. attackers location direction to the player who was attacked. Check the attacked players getDirection() and compare the two vectors to see if it was from behind
wtf when you give yourself an knowledge_book and rightclick it, it will dissapear. In console it states that it has a null tag
is this a bug?
How do i cast Bukkit#Block to NMS block?
probably needs a namespace or something for the knowledge
so its a bug
what is LocalizedName
An item name for the specified language
of the player
for example if the player select Deutsch
it will send itemname
you set for that locale
because for some reason server gets player's locale info
through the packets
even though there's no usage for that in vanilla server
maybe im wrong
Im getting this error https://paste.md-5.net/ejivuyeruj.cs this is my code https://paste.md-5.net/itutapekin.java
am i doing something wrong here?
if (p.getEquipment().getHelmet().getItemMeta().getDisplayName() != null) {
String helmet = p.getEquipment().getHelmet().getItemMeta().getDisplayName();
}
else {
String helmet = p.getEquipment().getHelmet().getType().name();
}```
the npe wont go away
the problem is the NPE is actually
String helmet = armor.get(uuid + ".helmet").toString();
in the other class
getHelmet() can be null, as can getItemMeta()
so idk what is causing it
the only thing in there that can't be null is the getDisplayName
i only dont get null from it if the helmet has been used in an anvil
but now i only get null no matter what
Yes, you are not doing ANY null checks
i thought an if statement is how
the one null check you are doing is on getDisplayName() which can't be null
if p.getEquipment().getHelmet() returns null, you can't use getItemMeta()
if getItemMeta() returns null you can;t call getDisplayName()
even getEquipment() can return null
hmm i haven't checked if they have a helmtet true
you have to check every single place it can be null.
EntityEquipment equipment = p.getEquipment();
if (equipment == null) return;
ItemStack helmet = equipment.getHelmet();
if (helmet == null) return;
if (helmet.hasItemMeta()) {
// code - helmet.getItemMeta().getDisplayName()
}```
how can i get nms' EnumHand from EquipmentSlot
evt.getHand() == EquipmentSlot.HAND ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND good enough lol
this is the 1337 way of doing it
EntityEquipment equipment;
ItemStack helmet;
ItemMeta meta;
String displayName;
if (
(entityEquipment = p.getEquipment()) != null
&& (helmet = equipment.getHelmet()) != null
&& (meta = helmet.getItemMeta()) != null
&& (
(displayName = meta.getDisplayName()) != null
|| (displayName = helmet.getI18DisplayName()) != null
)
) {}
getI18DisplayName()
papper
Is it possible to remove NPC from tablist that is created with NMS packets?
tried this:
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc));
but it load them without skin and when i join to server and they are not nearby, the will not spawn at all
hey, any idea how this might have functioned? (dead drive links) https://bukkit.org/threads/prevent-certain-items-from-smelting.476808/
summary: make it impossible to smelt a certain item
Is console included in Server#broadcast(String message, String permission)?
Yes
run it 1 tick after npc spawn
I think when player try to put specific item that you dont want to smelt into furnace, get InventoryClickEvent, check the inventory typ, check the item, if it equals, cancel it and send him a message or something... same deal with inventory move item event when player tries to smelt item that is delivered to the furnace by hopper
tried it even 100 ticks after, but if the player is not in this interval nearby them, they will not spawn, or not have skin either
there's like a prepare smelt event or something iirc
i'm not sure what vanilla does with unsmeltable items
if it lets you clog the furnace with them, then whatever you're doing should probably too
and vice versa
awesome, thanks
that is fired only right as the smelt bar reaches the end I think
thank you I will try this
in a similar vein, is there an event for smithing? If not I guess I can use the same logic as with the furnace
the anvil mechanics in the game are pretty fucked and the protocol around that area is trash
it's possible to get stuff working with the pre anvil and anvil events but it's never fun
nah not even the anvil, but thats a good point too, I meant the 1.16 smithing table
also fucked iirc
really weird how they introduced a new block just for netherite
basically all of the interactable inventories added after furnace are fucked
is that an API thing or a mojang thing
both
the protocol is super cancer around those parts, with how the server and client communicate about stuff
with the client doing whatever it wants and ignoring the server and vice versa
it's a shit show cobbled together from shit that somewhat functions in vanilla, but trying to write an api that doesn't shit bricks when you try to do something with it is hard
a lot of these issues could be circumvented if spigot supported adding new blocks and items like i.e. fabric/forge, and just sent a vanilla ID to the client
mojang support for that is pretty lackluster currently as well
mojang support for extending the game has always been pretty crap
you can modify the textures of existing items and their subtypes, and you can like add and modify loot tables and world generation stuff and some other mechanics like climbable blocks through tags
they dont really acknowledge that modding keeps the game alive and try to keep it unofficial for some reason
ah yeah they are pushing data packs
and I suppose there's recipes in datapacks now too but they are kinda trash right now and won't help you with anvils and whatnot
but those aren't a replacement for plugins and mods
it's still a long way from being fully data driven
using datapacks also seems like a very easy way to make the game less efficient than it already is
and since splƶgget needs to work with vanilla clients, it can't exactly send whatever it wants to the client
yeah but as long as it sends valid packets then it should be ok, right?
i.e. if I added a steel ingot that is treated as its own item server-side but represented as a netherite ingot when sent to the client, it shouldn't mess up too much
yeah, but mojang's support for data driven stuff is still in its infancy even on the client
true
and it's not like bukkit is having a good time with the data driven shit either
we haven't even gotten rid of the material or biome enums yet
there's some pr for it supposedly but it's probably not going to be merged in the next decade
1.18 is the update for the servers guys just you wait
oh yeah enums wont work for runtime generated shit
vanilla seems to be getting its own sort of oredict which sounds decent
or it already has idk
pretty much everything is already registries and data driven internally
just the api can't reflect it because muh fucking 1.8 plugins backwards compat will break
1.8 plugins are the best 
fun fact 1.8 is closer to Minecraft's first 2009 release than it is to now
ik, so its what the ogs play!
I've been mentally stuck on 1.12 since 1.7.10 died so seeing anything that came after it always feels fresh
can't expect features to not take up resources
1.12 ran fine, but 1.8.8 has the best jars
i remember back in the day when my shitty laptop could run a singleplayer world with like 100 loaded villagers
we expect it all!
now modern server grade machines will fucking catch fire and die with 100 loaded villagers
its not really the features that take up resources, they have some questionable coding practices from what I've heard
they throw streams around a lot
don't streams make use of multithreading so it should make the server run better?
paper has squeezed quite a bit of more performance out of the serbur by just replacing streams with not streams
streams are just for loops with syntactic sugar and more overhead
apparently paper is not as thread-safe as spigot
that is a strange statement
I think Bestle made a pretty good 1.16 jar though
so its possible to make a server run fast on it
just strip everything out and it'll run fast
but expecting vanilla functionality is out of the question
my source hasn't used spigot since 1.12 so maybe that's not valid anymore
it was pretty fuckin fast XD
held 500 players no issues
yeah in like a lobby somewhere
no
paper is bleeding edge of things. Sometimes it works well, other times it has some bugs lol
Spigot is the stable line of things
i'd argue the bleeding edge is a bit further downstream these days
of course the bleediest edge is yatopia
Yes sometimes Mojang doesn't always use the best code, but that isn't always possible for them
they should strive to update it after they created it though
i don't blame the developers
they've got the suits pushing them to create more content and revenue as fast as possible
yeah, most of the time it isn't the developers choice in what they get to work on
fortunately that is changing though š
i'll believe it when i see it
with more indie developer games and what not game studios are not obtaining the talent they need
eventually they will be forced to change their ways
crunch time is something that needs to die in a fire -.-
that worked pretty well
completely unnecessary most of the time
so this worked pretty well, hoppers dont insert to it at all but if you spam with the mouse you can still get an item in (and its not just client-side). Any idea what second measures I could add?
@EventHandler(ignoreCancelled = true)
public void onInventoryClick(InventoryClickEvent e) {
if(e.getClickedInventory() instanceof FurnaceInventory) {
if(CustomItem.getFromStack(e.getCursor()) != null) {
e.setCancelled(true);
}
}
}
I think it happens if I both left- and right-click simultaneously
are you sure you don't just want to cancel the smelt events
yeah those only occur after the fuel is used and the item is fully smelted, from what the docs say
what is p in this case?
did you try the prepare smelt event
player
ah player
or whatever it's called
i vaguely remember there being an event that's fired before the smelting starts
that is for fuels IIRC
I don't see an updateInventory function, best I can do is e.getWhoClicked().getInventory()
could just remove the furnace recipe from the recipe map š
yeah but that would do it for vanilla items too :/
ahh ty
hmm I can still spam it, and I don't even narrow it down by event so it should be more strict
the method returns a HumanEntity which doesn't have a player inventory to update
which is like some strange sort of npc support from mojang's side
@EventHandler(ignoreCancelled = true)
public void onInventoryClick(InventoryClickEvent e) {
if(e.getClickedInventory() instanceof FurnaceInventory) {
if(CustomItem.getFromStack(e.getCursor()) != null) {
e.setCancelled(true);
Player p = (Player) e.getWhoClicked();
p.updateInventory();
}
}
}
you'll find yourself casting humanentity to player when working with inventories
you need to listen to drag event as well
dragging even 1 pixel with lmb down will fire a drag event rather than the click event
even if you're only placing items in one slot
i'm guessing you spamming your lmb is causing your mouse to sometimes move a pixel or two with the button down, which then goes past your listener
thought updating the player's inventory would change it due to some quirk
I think NNY is right
i'm a pretty right guy
added the drag event and it still doesnt seem to work :/ just got 32 of one into the furnace
well it's definitely a thing that happens
weird that it happens at all, you'd think it would be a client side thing at worst
@EventHandler(ignoreCancelled = true)
public void onInventoryClick(InventoryClickEvent e) {
if(e.getClickedInventory() instanceof FurnaceInventory) {
if(CustomItem.getFromStack(e.getCursor()) != null) {
e.setCancelled(true);
}
}
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent e) {
if(e.getInventory() instanceof FurnaceInventory) {
if(CustomItem.getFromStack(e.getCursor()) != null) {
e.setCancelled(true);
}
}
}
@EventHandler(ignoreCancelled = true)
public void onInventoryMove(InventoryMoveItemEvent e) {
if(e.getDestination() instanceof FurnaceInventory) {
if(CustomItem.getFromStack(e.getItem()) != null) {
e.setCancelled(true);
}
}
}
forgot to ignore cancelled but shouldnt change anything
I need to stop an item from being smeltable if it has certain NBT (i.e. it is a custom item)
if a PlayerShearEntityEvent event triggers, can i expect EntityDropItemEvent to trigger right after without anything else happening in-between?
uh, let me check
interesting, ill try that
Does anyone know how I can get the server TPS?
the sound is fired first
Bukkit.shutdown()
but other than that there shouldn't be anything happening in between
Not in Spigot
since it's single threaded it should work fine though i think
Couldn
acciidentally pressed enter smh and I couldn't find it
what would I calculate?
TPS is a stupid metric
mspt is just inverse tps...
Math.min(20, tps)
point being its completely unclear as to what 'tps' even is
TPS: 100 (20)
ticks in the last second? rate of the last tick? rolling average? weighted average? simple average?
uhh not fully
it has the side-effect of cancelling your action if you want to put the item back into your own inv, and also the drag problem persists
saying tps is useless because it can't be defined in an instantaneous context is like saying that the rpm or speed gauge of your vehicle is useless because of the same reason
mph is the derivative of a smooth continuous function
its absolutely not comparable to tps
lots of custom spigots add graphs to /tps
units of action per units of time
they are the same, the only difference is that ticks go through discrete increments
How get texture skull with ItemStack?
of a smooth continuous function
SkullMeta
and?
1/Max(mspt, 0.05) is the best approx you'll get for TPS at a single point
and that's literally the difference that creates the problem we're talking about
and what even is the problem
why are my messages getting deleted...
because the bot is trash
SkullMeta
'TPS' is a meaningless measure and you need to figure out what exactly you want and for what purpose
SkullMeta.get what? xD
setOwner
GET texture
?
i disagree with your assessment
SkullMeta
get the property representing the texture
TPS is a general indicator of server load, but thats all.
mspt is the single most prominent indicator of how much time you have versus how much time you need on the main thread
I think you don't understand me
wdym
mspt of what?
the last tick?
the last 5 ticks?
the average of the last 5 ticks?
depends on what you want
do you want stability or precision?
10 50 100?
you can get the current nanoseconds spent in the current tick if that's what you want
50 100 1000
'TPS' is a meaningless measure and you need to figure out what exactly you want and for what purpose
idk
I want get texture with skull (ItemStack) texture no owner
this is the same reason as for the Heisenberg principle
and mspt is a very good general indicator for the vast majority of such purposes
Replace "ItemMeta" with "SkullMeta"
then use #setOwner
and also same reason why FFTs (e.g. when displaying frequencies present in some music at a certain "point" in time) need a defined RMS
if you've ever seen a music visualiser with bars, those are the frequencies over some period of time (say 50ms)
get texture (no set)
is discord dying or is it my internet
dicord
Hey guys do you know how to add potion effects while holding an item? i created everything but effects are applying when i change slot and idk what to do
maybe keep a bool in memory for each player and set it to true when the player holds the item and to false when he holds something else?
thats the best solution I can think of
i will try thx
or alternatively, apply the effect for 2s and check as it is about to expire
Ok
But that still doesnāt make sense
How do you want to get it
The name
Save it
How
oh wait you want to apply it just when they hold it but it stays after they de-equip. I read it wrong, thought you wanted to apply it continuously
what is your code for the held item event?
Is your event firing?
public class onInteract implements Listener {
private ItemStackEme aura = new ItemStackEme();
@EventHandler
public void onHeld(PlayerItemHeldEvent e) {
Player p = e.getPlayer();
ItemStack i = e.getPlayer().getItemInHand();
if (e.getPlayer().getInventory().getItemInHand().isSimilar(aura.getEmerald())) {
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 2));
p.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 100000, 2));
p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 100000, 2));
} else {
p.removePotionEffect(PotionEffectType.SPEED);
p.removePotionEffect(PotionEffectType.FIRE_RESISTANCE);
p.removePotionEffect(PotionEffectType.REGENERATION);
}
its something like this
```java
code here
```
oh thx
?paste or that
could it be that the event isnt firing when you hold nothing?
potion effects should really be by plugin
ublic class onInteract implements Listener {
private ItemStackEme aura = new ItemStackEme();
@EventHandler
public void onHeld(PlayerItemHeldEvent e) {
Player p = e.getPlayer();
ItemStack i = e.getPlayer().getItemInHand();
if (e.getPlayer().getInventory().getItemInHand().isSimilar(aura.getEmerald())) {
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100000, 2));
p.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 100000, 2));
p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 100000, 2));
} else {
p.removePotionEffect(PotionEffectType.SPEED);
p.removePotionEffect(PotionEffectType.FIRE_RESISTANCE);
p.removePotionEffect(PotionEffectType.REGENERATION);
}
what do you mean
like chunk tickets
so you can keep a chunk loaded from multiple plugin if necessary but if one plugin removes its ticket the other one will keep the chunk loaded
so that if you drink a speed potion you get minecraft:speed but if your plugin gives an effect it gives plugin:speed and then it can remove it without affecting the original time
potion effects are fucked
ig
a ticket or namespace based system like that would be great
i doubt anybody is ever going to get around to making it happen though
we sort of have that with attributes and attribute modifiers
got it working, ty those that I cant tag cause bot doesn't like me š
https://hatebin.com/hzkumdoovz
sorry for stupid questions but where i have to paste it?
sorry that was just my code for a different thing
?paste
paste!
How read Value with NBTTagCompound
{SkullOwner:{Id:"868344cc-6b00-11eb-9439-0242ac130002",Properties:{textures:[{Value:"WHAT I WANT READ"}]}}} I try this tag.getCompound("SkullOwner").getCompound("Properties").get("textures");
just get the texture property through the api
how?
not sure how you do it with spigot, but it ought to be possible
get the skullmeta and get the skull owner and then get its "textures" property
SkullMeta haven't texture
what type do you want the texture as?
public static ItemStack createHead(String url, String name) {
ItemStack head = new ItemStack(Material.PLAYER_HEAD);
if (url.isEmpty()) {
return head;
}
SkullMeta headMeta = (SkullMeta) head.getItemMeta();
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", url));
try {
Field profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(headMeta, profile);
}
catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
ex.printStackTrace();
}
headMeta.setDisplayName(ChatColor.RED.toString() + ChatColor.BOLD + name + " Head");
head.setItemMeta(headMeta);
return head;
}```
no create
he need to read the texture
get texture with skull
and modify it
this no
just getting?
yea
hdb api lol
1minute
?
@main dew which version you are using?
1.12.2
Hello, anyone? š
I have a question. Im trying to reload my config from another class, and im getting a error with this line:
EasySpawn.getInstance().reloadConfig();
Here is my main class:
public final class EasySpawn extends JavaPlugin {
private static EasySpawn instance;
FileConfiguration config = getConfig();
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "EasySpawn has successfully loaded!");
getServer().getPluginManager().registerEvents(new Events(this), this);
this.getCommand("esreload").setExecutor(new ReloadCommand());
}
public static EasySpawn getInstance(){
return instance;
}
}```
Here is my reload command class:
```js
public class ReloadCommand implements CommandExecutor {
EasySpawn plugin;
public ReloadCommand(EasySpawn instance) {
plugin = instance;
}
public ReloadCommand() {
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equals("creload")) {
if (sender.hasPermission("chatmessage.reload")) {
EasySpawn.getInstance().reloadConfig();
} else {
sender.sendMessage(ChatColor.RED + "You dont have permission to use this command!");
}
}
return true;
}
}```
I'm super confused on how to fix this? Ive been looking at this for too long š
@main dew I will be back for you I will just get shower
oke ty
just txt me in dm
@hidden delta
((NBTTagList) tag.getCompound("SkullOwner").getCompound("Properties").get("textures")).get(0).getString("Value");```work š
this I make alone
but how I search this in google I find this
and in this I find this java tag.getCompound("SkullOwner").getCompound("Properties").getList("textures",10).get(0).getString("Value");
why doesn't my config save
plugin.getConfig().addDefault(uuid + ".chestplate", chestplate);
plugin.saveConfig();```
.options().copyDefaults(true)
or just add and no default
@sullen marlin you are faster than me
or I'm thinking of set
does it matter which class?
what lmfao
nvm
Hello, does anybody have an idea about this? š
Also, this not working too
https://paste.md-5.net/jucuzafeni.java I watched this https://www.youtube.com/watch?v=n-NltGKBnOY
In this video, I went over how to remove and replace pathfinder goals for custom 1.15 spigot mobs :) Next video is over custom pathfinder goals!
Download XAMPP: https://www.apachefriends.org/download.html
SQL Info: https://www.w3schools.com/sql/sql_syntax.asp
Want more videos?
Become a Patreon support to gain access to more videos!
Pa...
And another mob is working
only Vindicator not working
?paste
bruh
try defining goal selector inside the method, also you set the goal but never run it
I already checked with bukkit.broadcastmessage š
and what method are you saying?
goalSelector
put the field inside the method
also as I previously said you select the path
but never run it
or set it to an npc to run
I have a test variable, and I am taking a string message from config containing %test% as a placeholder. Now I want to replace that %test% to variable test. How do I do that?
String.replace
how do I use custom font for item name and lore tho
Probably NMS
I donāt think we have support for components on items yet
But I could be wrong
I found out you donāt seem to be able to damage an entity with a specific cause without NMS
Which is unfortunate
small question : what is PathfinderGoalFloat ?
I presume it has to do with flying entities / floating entities
ty
small question 2: Is there a pathfindergoal that allows entities to move to players?
Long time since I worked with it
thanks you. can you gimme example?
i dont know args
this.goalSelector.a(0, new PathfinderGoalTarget(hmm?));
ah
then you have a goal on the goal selector which is something like PathfinderGoalMoveToTarget
btw, should I use it like this
@Override
public boolean a() {
return false;
}
});```
ah
ty
It doesn't exists š¦
and I was tried hard to find the goals
but i couldn't find
There is
PathfinderGoalMoveTowardsRestriction() and PathfinderGoalMoveThroughVillage() and PathfinderGoalMoveTowardsTarget() only. in "Move" keyward
I meant, PathfinderGoalMoveToTarget doesn't exist
and PathfinderGoalMoveTowardsTarget() doesn't go to target. it goes to nearly target
I feel like he avoiding target.
Also, pillager doens't attack if he held diamond
how can I make him to attack player
`That's why I want to do it.
Hey everybody, how do I create a hover tooltip for a chat message in Spigot 1.16.5?
Answers I found online state that I have to create a TextComponent and then use setHoverEvent() on that, but I couldn't find anything about either on the spigot javadocs
Has it been removed? If yes, what's the best way to do it as of now?
u use bungee's api
it's built into spigot's api i believ
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
String MSG = plugin.getConfig().getString("FinalKillMessage");
MSG.replace("%victim%", vicname);
MSG.replace("%killer%", name);
a.broadcast(ChatColor.translateAlternateColorCodes('&', MSG));
why this is not working
both vicname and name are defined as Player.getName()
use the .replace on the String MSG.
String MSG = plugin.getConfig().getString("FinalKillMessage").replace(...);
strings are immutable
MSG = MSG.replace("%victim%", vicname);
also avoid all caps for local variables names
thanks
Team k = a.GetPlayerTeam(p);
String kcolor = k.getColor().toString();
This gives Color:[rgb0x00FF] as kcolor
So I need to make a placeholder for color and when used in config it should work as a color code. I am confused how will I do.
Possible to give distance attribute to CustomName?
package de.lennard.development.gui;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.scoreboard.*;
public class Scoreboard {
@EventHandler
public void join(PlayerJoinEvent event){
Player player = event.getPlayer();
ScoreboardManager m = Bukkit.getScoreboardManager();
Scoreboard b = (Scoreboard) m.getNewScoreboard();
Objective o = ((org.bukkit.scoreboard.Scoreboard) b).registerNewObjective("Gold", "");
o.setDisplaySlot(DisplaySlot.SIDEBAR);
o.setDisplayName(ChatColor.DARK_AQUA + "Lennard's Community");
Score gold = o.getScore(ChatColor.WHITE + "Skill: " + ChatColor.GOLD + "10");
gold.setScore(1);
player.setScoreboard(b);
}
}
This gets me a error:
incompatible types: de.lennard.development.gui.Scoreboard cannot be converted to org.bukkit.scoreboard.Scoreboard
Why?
wrong import
or you're mixing types in your plugin
suggest renaming class de.lennard.development.gui.Scoreboard
Because they are two different classes. You cannot cast your scoreboard to the spigot scoreboard
._.
how can I simulate the particles when a coblbestone gets generated
setDamage(0) on Damage Event
you can also cancel the event
but i just want something with player.
You need to use EntityDamageEvent i think
maybe, idk š
Hum, hi guys. Does anyone have any idea why when I send a playerinfopacket with inside an entity with a skin to a target player if the target is still joining it spawns the npc without rendering the skin?
Hi, i got a problem with my plugin. I get a NullPointerException(i think)
Log: https://pastebin.com/NphKtiLj
Code: https://github.com/PixelAgent007/ezmana
btw. the 3 functions in ManaController.java have to be static, i cant change that
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.
You can't get the config from null
?paste
.
.
š¦
?
Give me the engine ok thx
Line 15 ManaController. Main is always null
@static bay Very nice is this publicly available or going to be?
@near crypt Please refrain from pinging MD
@languid geode Sadly won't until we can provide some sort of partnership with MM or Blockbench. We'll need to polish this in order to do so.
Fair make them š° first š
Timer
You may want to use RepeatTask
How can I change a users Skin only while they are on my server?
so this would do it every second right since its 20L which means 20 ticks?
BukkitScheduler scheduler = getServer().getScheduler();
scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
// Do something
}
}, 0L, 20L);```
I think so
- 20 š
o
Yep
ok
I did it slightly different in my plugin
?
so it would be 15 seconds?
Yep
Each 15 seconds it reloads the scoreboard
So that the users money is always recent
For bedwars?
Nah for a skyblocc server
Ah I see
I have come to the realisation that the quality standards are so low in my country
What country?
turkey
I'm from germany
hwo can I write to a default config
Default config wdym?
Then why not just create a yml for that?
ah
But it shouldn't be difficult
Xd
declaration: package: org.bukkit.configuration.file, class: YamlConfiguration
huh
lets hope this works
getConfig().set("demir."+ event.getPlayer() +"", event.getBlockPlaced().getLocation());
if you're storing it long term I'd advise using their uuid
event.getBlockPlaced().getLocation() btw this will return serialized object string
he's also using even.getPlayer()
ah
Location is serializable
just gonna get craftbukkit{hhdhehendn}
Player is not, use their uuid
is GameProfile no longer available?
i don't remember if it ever was on spigot
hmmmm
need either the nms or paper's playerprofile api
are u sure?
not really
bcz I guess it was in spigot
my guess is based on how skullmeta doesn't seem to have any methods to get the owning profile
i haven't really looked
What you need?
GameProfile
hi
Have you tried i dont the the documentation
please
Any errors and whats the expected behavior
where
for (Entry<String, Integer> entry : valores)
valores is probably null
valores is a list
the import was
import com.mojang.authlib.GameProfile;
sure
what i do?
you make it not null
after
You wait until i get see wtf this code is i need to go grab some eye bleach
valores = streamOrdem.collect(Collectors.toList());
streamOrdem is empty then
on the streamorder
sure
yeah you haven't imported it as a dependency in your IDE
it's not part of spigot-api
Why are you using so mean stream operations this hurts
you'll have to import the mojang authlib in your dependency manager or whatever you use
@wispy monolith You need to import the build spigot jar
not the maven variant it only contains bukkit
How can I import that in maven
or alternatively build spigot locally and build against spigot instead of spigot-api
without manual import
you'll need to find the maven/whatever artifact information for it
and then enter it into your dependency manager
alternatively, build spigot locally and build against spigot instead of spigot-api
Do u know where can I find it? or what should I google?
dunno
searched for "mojang authlib dependency artifact information"
second search result
first search result is a forum thread on spigot where a bunch of seething tards tell the guy to import spigot jar as an artifact and nobody gets anything useful done
those can be generally ignored
why
spigot = craftbukkit
what are you trying to do with craftbukkit
what is the best way to make "List<Entry<String, Integer>>" not be null?
i'm learning java recently
stuff
NMS?
@ hesham
ah, sure
the import must be like this
nms = net.minecraft.server
yes
that is included in NMS
which is included in spigot
the namespace belongs to craftbukkit because craftbukkit is the one who originally declared the class
But the CraftPlayer isn't there
its correctly?
Didnt i explain this a few posts back you need to import the spigot jar not the spigot-api maven
build spigot locally and build against spigot instead of spigot-api
the dependency information is the same except for the name, which is spigot instead of spigot-api
I did but they told me to import using maven like a week ago and I started using maven
yes, import it via maven
system scope?!
its no correctly
i know its bad
I want to import other stuff and it always tries to import it for the spigot repo even I insert the repo of the thing I want to import
show your pom
why?
repo I need
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
wot
<dependency>
<groupId>com.mojang</groupId>
<artifactId>minecraft-server</artifactId>
<version>1.4.4</version>
<scope>provided</scope>
</dependency>
are u dumb?
import spigot
š¤¦āāļø
it's included in spigot
Im not even
But I already used maven
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
already there
SPIGOT
smh
HAHA im laughing my ass off he just wont listen
<artifactId>spigot-api</artifactId>
change to
<artifactId>spigot</artifactId>
imagine Mojang publish minecraft-server to public maven-repo
Lolz never happening i had to fight tooth and nail to get access to their github
whose github?
mojang's
They do actually
lol
but only a few select people have access to it mostly community developers
bro why pumpkin deprecated
:what:
you're deprecated
literally tells u
I know ;-;
imagine reading
RTFM
i miss people using this
but pumpkn :(
newbie dev never read javadoc
?suicide
if u need to change stuff about the pumpkin, Directional will work just fine
i know why its deprecated i spent 3 hours trying to get the face of a pumpkin yesterday
yes yes directional good
I spent 6 months to understand all Minecraft, Forge, Fabric artifact
and now I only understand 30% of them
thats kinda ur fault
i spent 2 days learning how to make spigot plugins
welp
suprisingly very easy
because it has javadoc
Minecraft doesnt
mcwiki
so what do you actually do in the minecraft area
coding server
That doesn't support plugins affe