#help-development
1 messages · Page 1443 of 1
np
Ok
I give up
public void onInventoryClick(InventoryClickEvent event) {
if (event.getClickedInventory() instanceof PlayerInventory) {
Player plr = (Player) event.getWhoClicked();
Location loc = plr.getLocation();
for (ItemStack item : event.getClickedInventory().getContents()) {
if (item == null)continue;
//ItemStack itemClone = new ItemStack(item.getType());
//if (!(item.isSimilar(itemClone)))continue;
if (NBTEditor.getBoolean(item, "ischecked"))continue;
for(String key : plugin.getConfig().getConfigurationSection("blocks").getKeys(false)){
if(item.getType().toString().equalsIgnoreCase(key.toString())) {
plugin.getServer().getLogger().severe("d");
if (!(item.getAmount() >= config.getInt("blocks." + key)))return;
plugin.getServer().getLogger().severe("e");
sendWebhook(item, plr, loc, item.getAmount(), false);
punishCheck(item, plr, loc, item.getAmount());
}
}
}
}
}
help
for some reason this aint working
if(item.getType().toString().equalsIgnoreCase(key.toString())) {
blocks:
sand: 12
this is the config section for blocks
if(key.equalsIgnoreCase(item.getType().toString())) { i changed it ot this and it still dont work
its just normal sand
no NBT
no
Maybe try that
Check the config file
its only sand
Evidently it’s not
this is in my onEnable
public void onEnable() {
loadConfig();
private void loadConfig() {
saveDefaultConfig();
}
}
blocks:
sand: 12
thats the one
inside the server config
It has nothing to do with netherite_block
the default config is
blocks:
netherite_block: 64
but thats the defaULT CONFIG
not the one i have saved
No idea
I don’t really use the built in config API so I’m not sure how default configs work
no issues
public void punishCheck(ItemStack item) {
item.setType(Material.AIR);
plr.updateInventory();
}
fix them yourself
i have this method
Is there a way w/o NMS/Packets to cancel a dismount event?
that method is being called
and a item being passed to it
it should still change the items type right?
well EntityDismountEvent implements Cancellable
depends how you pass in the item
ItemStack item
and i call it with method(item)
it'll obviously change the item, but will it update in the player's inventory?
i have player.updateInventory()
a useless method
it just odesnt effect the item still
when changing an item, the inventory will update
Oh ok
again, how are you passing the item in
Don’t setType to null
what do you mean?
where are you getting the itemstack from
Set the slot in the inventory to null
Im looping through every item in the inventory
not happening
could do item = null;, no?
ill try it
lol what why
for (int i = 0; i < inv.getSize(); i++) {
if (!(matches your criteria)) continue;
inv.setItem(i, null);
}```
yea no
thats not working
nor is it the issue
if(config.getString("punishment").equalsIgnoreCase("delete") || config.getString("punishment").equalsIgnoreCase("both")) {
item.setType(Material.AIR);
plr.updateInventory();
}
this is called through a method
in the config punishment is set to delete
and it was working before
so idk
for like the fifth time, how are you passing the item into the method?
is it just player.getInventory().getItemInMainHand?
What does that mean
oh
no
**for (ItemStack item : event.getClickedInventory().getContents()) {**
now see
im passing item
getContents is a copy
so it doesn't actually have the references to the original items
ok, then why did it work before?
@EventHandler
public void cantdismount(EntityDismountEvent e) {
if (e.getDismounted().getName().contains("sucks_cant_leave")) {
e.setCancelled(true);
}
}
Tried this, but on my screen I dismount and can move around, but on others im there
ah yes the classic desync
you could probably let it happen and then mount the player back on one tick later?
does the same thing
save getContents to an ItemStack[] and use inventory.setContents after you're done removing
I would try cancelling the entity interact event instead
Might look a little funky but it may stop the Dwayne
ok
EIaE is called for dismount??
What
thanks
what are you talking about cancelling
.
Ah wait it’s dismount
@sage swift welp. Now i gotta figure out how to do the same thing, but for a chest
its not working
Like i trieds it already
You’ll need to manually send a mount packet to the client
Or just mount them again a tick later I guess
item.setType(null);
inv.setContents(items);
plr.updateInventory();
no need for the updateInventory
ok
and i believe you need Chest#update
not quite sure about whether it's needed for inventory manipulation
?
I looked up the documentation
cant find it
what do you mean by "i gotta figure out how to do the same thing, but for a chest"
So, it should do the same thing. Remove the item
wait
ok, so does it matter if i put api version in the plugin.yml
shouldn't change anything about the plugin, no
cause thats the only thing i changed and this all stopped working
Using setItem(slot, null) would work for any inventory
it is the fucking API version
you can only set ti to 1.13+
I just deleted the thing entirely
and the plugin works
theres a dumb message on startup
but it works
That makes 0 sense
I guess removing it defaults you to legacy materials, maybe that somehow affects it
But please don’t do that
why?
Because you shouldn’t be using legacy stuff if your plugin is meant for modern versions
Also the legacy material system is cursed
speaking of
im having issues with that right now
how do i fix it so im not relying on the legacy system
nvm
ill fix it tomorrow
So I have an interesting question for any world gen junkies
is it possible to generate a new world with a custom generation starting point?
Add an API version
probably not, you have to account for all chunk's generation
without a certain starter
Trying to help this poor guy https://www.spigotmc.org/threads/calculate-ore-vein-locations-by-a-seed.505721/#post-4163518
It's funny, because just a week ago, someone was here looking to hire a developer to do this exact thing.
And the person who created this thread is a paid developer 🤣
so why do you need to generate it from a starting point
he could look at the generation code and ore generation...
and be able to locate specific veins of ore from that?
I have trouble wrapping my head around a way to do that
simulate the generation, yes
best of luck
cannot for the life of me find the ore generation though
doesnt ore generation rely on all passes of terrain generation though
it wont spawn just in mid air
it would, in the end, be basically the same as generating a full world - exclude block populators
still an interesting question
lmk if you find any resources
yeah that's true it would depend entirely on other generation features
EntityDropItemEvent isn't called when an entity dies
is there a different event for items from death?
you should be able to get the drops from EntityDeathEvent.
1.16.5 definitely has this, no idea on how far back you can go before it's not there
on 1.16.5, but i want to do stuff with the Items themselves, not the ItemStacks
using that now, just comparing locations
any1? 🙂 
what
you mean the Item entity right
Maybe a scheduler with a #getNearbyEntities after EntityDeathEvent?
entitydropitemevent is for when they drop items without dying
like, uh
a zombie drops a tool after picking up a new one
or something
for the actual drops you need to use the entity death event and that only gives you itemstacks
and it doesn't even include all of the drops
wither roses f.e are not in the drops list
can someone help me, I need to write a code for, logging the timestamp when a player joins, logging the timestamp of players when the server is closed or the player leaves, record both timestampsto know the playtime of player into seconds, minutes, hours and days
Log the data in to MySQL
What i have done: Linked the plugin with MySQL defined the player join event
You can get the time played using Statistic.PLAY_ONE_MINUTE
Do you need the recorded timestamps just for tracking the time? And if not, do you need them separately or only one variable that holds the last recorded instance.
i am making a plugin to record a player's playtime and link it with mySQL
i need the entry and exit timestamps of player so that they can be turned into the play duration
Minecraft already tracks the time played...
But if you want to track it yourself:
Use the PlayerJoinEvent and the PlayerQuitEvent to track the time delta between joining and leaving.
Server stop doesnt need to be tracked as every player is kicked and the PlayerQuitEvent is fired.
@quaint mantle
do a network request to the db every tick for every player to increment their ticks played by 1
remember to do it on the main thread
is there a way to make one command to run multiple? 🤔 like replace %player% with player name and %kicked% for their kick reason? 🤔 i quite struggle with that xD 😅
Create a new table for every tick and add all players in there. Then you can later add up all tables that contain the UUID to know the total ticks played
What do you mean by "make one command to run multiple"
This has nothing to do with your second sentence...
lets say we have this at the config
forwardcommand:
commands:
- kick %player%
- staffmessage %player% got kicked for %reason%
has something to do with hashmap xD
.replace.replace.replace
So from your config -> List<String>
Then iterate over that list and execute each command after replacing all possible placeholders
hmm ok but should we use timestamps to track time?
or is there an more efficient way?
im using packetevents plugin for this
with WrappedPacketInBlockPlace how could i get if they actually placed a block or if they just right clicked a block? also im using PacketType.Play.Client.USE_ITEM because PacketType.Play.Client.BLOCK_PLACE didnt work
Can Someone Help Me With this Error https://paste.md-5.net/wusogiheji.pl
what happened to simply using the interact event @outer sorrel
what's at line at me.Hazimis.lame.Main.onInteract(Main.java:70) ~[?:?]
ok ty
if (player.getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.YELLOW + "Profile") ){
Item in hand is null
anticheat
do a null check
ok
simple null checks should fix it
console just spams
or a vanilla item from creative
It worked only when you have ITEM ON YOUR HAND
when does it spam?
It spammed because you dont have any ITEM ON YOUR HAND
What are you even doing lol
how
um when i join i get the item lol?
Main is a very vague way to name a class
I used plyjoinevent xd
What does your plugin do son
it flags when any existing block is clicked
or is that for other person
open a gui when click a skull (must be named Profile)
so many people
the error you pasted doesnt relate to onEnable
the skill*
Yea ^
i never mentiond onenable
Check if the errors are different
i meant the error comes when the plugin is enabled
ON ENABLE
lol
but the error is NOT IN THE ONENABLE METHOD
ok dud
DO A NULL CHECK
lol
just do a simple null check like they told u
I dont remember exactly it returns null or return air
Check both
yes but you have to check player.getInventory().getItemInHand() is skull or not
it's better than null check
It does check
lmao
and it works fine
itemstack lol
f
the player has a stuff
Yes
so can you show me the spamming error?
if the plyer tries to click on the block on the 1 slot
the link
spams the same thing over and over again
also love the uppercamelcase on the OnJoin
until it stops xd
yea idk xd
Bro
can you check null: player.getInventory().getItemInHand().getItemMeta()
can you show us all the event class
k
public void onInteract(PlayerInteractEvent event) {
Action action = event.getAction();
Player player = event.getPlayer();
if (player.getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.YELLOW + "Profile") ){
if(action.equals(Action.RIGHT_CLICK_AIR)){
Inventory inv = Bukkit.createInventory(player, 9, ChatColor.YELLOW + player.getName() + "'s Profile");
ItemStack lol = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
stuff hapemns
}```
leave the inv part
k
forpgot to delete
are you sure that:
if (player.getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.YELLOW + "Profile")
is the line 70?
yep
Show proof
lol
literally put before the if (player.getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.YELLOW + "Profile") ){
if (player.getInventory().getItemInHand() == null)
return;
getItemInHand cannot be null
^^
whats the error?
but i want it to only work when i right click the skull with name Profile
so i have to check xd
ik
why e.getEntity().setBedSpawnLocation(e.getEntity().getLocation()); throws Your home bed was missing or obstructed
do you check if the entity is player?
getPlayer is a thing
;DDD
@EventHandler
public void OnDeath(PlayerDeathEvent e) {
if(plugin.getConfig().getBoolean("showDeathScreen"))
{
Location loc = e.getEntity().getLocation();
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
@Override
public void run() {
e.getEntity().addScoreboardTag("death-event");
deaths.put(e.getEntity().getName(), e);
e.getEntity().setBedSpawnLocation(e.getEntity().getLocation(), true);
e.getEntity().spigot().respawn();
e.getEntity().setGameMode(GameMode.SURVIVAL);
e.getEntity().setGameMode(GameMode.SPECTATOR);
}
}, 1);
}
}```
(basically it respawns the player where he died and puts into spectator mode)
did you check if the location isnt null?
null
it isnt null, since in other class it prints on the chat
try setBedSpawnLocation(loc, true)
Yeah it might actually look for a bed before respawning
I would teleport the player
is there a value for what is displayed above the player's head, and can i edit it?
that is the player's name
it is rendered by the client
to change it you need to change the player's actual name
you may be able to change it with protocol hacks without touching the actual userprofile but i'm not sure if that has weird side effects
i know there's customName and displayName but are those separate?
there is a good plugin for this: https://www.spigotmc.org/resources/nametagedit.3836/
ok, ill try it, thanks!
as far as I know it can be done without protocol hacking
you can set prefix and suffix to scoreboard teams
then you can join the player of your choice to this team
yeah but that can only append and prepend things to the name
it can't actually change the name
customName isn't used for players and displayName isn't shown in vanilla, it is used by plugins like chat formatters and whatnot
Hey, I'm a starter in Java and Spigot and I hope you guys can guide me in the right direction.
In my main class i got:
if(args[0].equalsIgnoreCase("add")){
AddItem.AddItemHolding();
}
And in AddItem.class:
public class AddItem {
public static void AddItemHolding(){
Player p = (Player) player;
PlayerInventory inv = p.getInventory();
p.sendMessage(inv.getItemInMainHand()+" added to configuration.");
}
}
But i have no clue how to make it so that i can declare player.
The function will be if somebody types pluginname add it adds the item the player is holding to the config.
Pass it as an argument to addItemHolding
there is probably no reason to have that in a static util method
any idea on how to do that?
do you guys know if sending a plugin message to bungee will be interpreted at the moment of sending it or it can take some time after it?
i'm trying to kick players from a server if it takes longer
but if i kick a player from the server
after i sent a message
how would that work
would bungee first read the message and then handle the kick?
Is there a wiki that tell me all the possible datawatcher object id with their values?
depends on the impl, i'm not sure
safest would be to have bungee respond with an "ok" once it's done with the data you've sent
and only kick the player then
alright, thank you
it's a few extra doodads but makes for a more robust protocol
😦
write me a good crates plugin
?
i need a good crates plugin
I think that you are a better developer then me...
XD
what are your requirements? lol
i could do a simple crate plugin
of course
and it'd have to support PDC values for the items it spawns in
that's my way of looking at it
fancy particles and maybe some shitty animation for rolling the loot is a plus but probably not necessary
i've looked at all of the popular crates plugins and either they don't support items with pdc values or they're "1.8-1.16" nms reflection nightmares
yeah
i think
most crate plugins use some shitty essentials-like item syntax
which supports jack shit
and is gay
lol
i had to look a bit on this problem
myself
even the bukkit serializer api wasn't cutting it
for my shulkers into shulker approach
but then i don't wanna limit my plugin to paper
still
like two thirds of the userbase
plus there's also the argument that plugins built against paper generally perform better on the majority of servers
well
so the +60% of serburs that actually do run paper would rather have a paper-specific plugin than one who is just generally written for splögget
i had my share of problems with paper
i have plenty of problems with them too
when i designed a minigame
they banned me for being hitler
and then banned me again for supporting 1.8
and then banned me a third time for being shrek
You're so cool
Tbh the shrek ban seems valid
@warm mica nice bedwars plugin :3
Thanks!
How can I remove hit sound?but no dmg hit sound. so i meant, how to remove entity.player.attack.nodamage sound
easiest is probably to drop the playsound packet
but if the sound is clientside, as some sounds are, there isn't really any way to do it
i have not changed my plugin.yml at all and now this happens?
[13:26:36 ERROR]: Could not load 'plugins\main.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.space.App'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:81) ~[patched_1.16.5.jar:git-Paper-669]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:137) ~[patched_1.16.5.jar:git-Paper-669]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:397) ~[patched_1.16.5.jar:git-Paper-669]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:305) ~[patched_1.16.5.jar:git-Paper-669]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:389) ~[patched_1.16.5.jar:git-Paper-669]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:252) ~[patched_1.16.5.jar:git-Paper-669]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1066) ~[patched_1.16.5.jar:git-Paper-669]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:290) ~[patched_1.16.5.jar:git-Paper-669]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]
Caused by: java.lang.ClassNotFoundException: com.space.App
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_291]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:182) ~[patched_1.16.5.jar:git-Paper-669]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:111) ~[patched_1.16.5.jar:git-Paper-669]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_291]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_291]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_291]
at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_291]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:79) ~[patched_1.16.5.jar:git-Paper-669]```
What is your main class
com.space.App
i cant post images but https://cdn.discordapp.com/attachments/584110853809373224/843827299421782036/unknown.png
Well I guess you wanna make sure the file actually made it into the jar
You could open it with your favourite archive manager
I have a plugin with the 1.16.5 jar and the api version and I want that you can also use this on other versions
how can I do this
Yeah I see that but concerning that the plugin yaml exists it seems to be to the jar that has an issue
If you wanna support older versions (why tho lmao) you will have to code against the lowest version
A plugin with API version 1.16 will not work on 1.15. you'll have to set it as the lowest version you wanna support
i dont know what to do about that
its a simple plugin so you can craft horse armor and above 1.12 the material name of horse armor changed and from 1.13 till latest its the same so yeah
Well there seems to be your issue huh
so i have to use the 1.13 api version?
Yes
okay thank you
ok ty its fixed now
👌
Which datawatcher obj do I need to modify to enable second layer skin?
public static FileConfiguration CitizensFile;
public static File file = null;
public void gogo() {
file = new File(Bukkit.getServer().getPluginManager().getPlugin("totoServerPlugin").getDataFolder(), "Citizens/saves.yml");
CitizensFile = YamlConfiguration.loadConfiguration(file);
CitizensFile.getConfigurationSection("npc").getKeys(false).forEach(Bukkit::broadcastMessage);
}
```Hello ! How can I get config file from datafolder? It doesn't work : ( (NPE)
how can i make FallingBlock won't disappear?
it disappears after about 10 sec when I summon
But do I also need to use the 1.13 jar? or can I use the 1.16.5 jar that I'm using right now
so I have to change the 1.16.5 jar in my external libraries to 1.13?
You don't have to but it's recommended so you don't use any new methods
okay and if I use the 1.16.5 jar in my library and put the api version to 1.16 can I use the plugin on any version of 1.16?
or only on 1.16.5
All 1.16 versions
how can I wait for a answer from a player?
The Conversation API might be worth using, depending on what you're trying to do
getPlugin("Citizens")
not your plugin
@chrome beacon, do you know when I can send the metaInfopacket to update an npc skin layer? I'm talking about this https://wiki.vg/Entity_metadata#Player
also you need getDataFolder() + "saves.yml"
file = new File(Bukkit.getPluginManager().getPlugin("Citizens").getDataFolder() + "saves.yml");
this is what you need to have
do you guys know if the player count can be modified?
what is the event for the packetplayinupdatesign?
There's no built-in events for packets them selves, you'll need to get protocollib or something, then it's just a matter of going through their documentation otherwise sign updates are SignChangeEvent
When it comes to ProtocolLib, iirc it's just a matter of listening for that specific event
Hi, I am trying to return a list but it is throwing a NPE.
What I am trying to do is use a dependancy injector to try to have a list that is the same in all of my classes.
But attempting to pull the list causes a NPE.
Class that stores the list: https://paste.md-5.net/ikepanofuh.java
Class that attempts to pull the list (causes NPE): https://paste.md-5.net/ogademaciw.java
Stacktrace: https://paste.md-5.net/ucajupowov.sql
Line 42 is ```java
if (speedrunnerTeam.contains(event.getPlayer().getName())) {
chances are speedrunnerTeam is null, which means manhuntGameManager isn't getting the list properly
ah
you're not setting the lists
oop
Initialize the lists m8
How? I have tried that but it sometimes just doesn't work.
like list = new ArrayList<>();
^
Yea I have tried that
Still causes a NPE
I have tried to put a new ArrayList<>(); in both of my classes
public ClearInv(Main main) {
this.main = main;
}
If you call this then it'll throw an NPE as well, since it's not initializing the list
?paste
public ClearInv(ManhuntGameManager manhuntGameManager) {
this.manhuntGameManager = manhuntGameManager;
this.speedrunnerTeam = this.manhuntGameManager.getTeam(Team.HUNTER);
}
Is the only constructor that properly initializes everything
Ye
ok
calling a constructor creates a brand new class
Does it tho
new ClearInv, yea
Oh u meant like that
Ye
New Code (ClearInv Class): https://paste.md-5.net/vasuyuxifa.java
New Stacktrace: https://paste.md-5.net/luyixurise.nginx
Line 40 is ```java
this.speedrunnerTeam = this.manhuntGameManager.getTeam(Team.SPEEDRUNNER);
under public ClearInv(Main main) {
Still produces a NPE.
manhuntGameManager isn't initialized
How to check if player is holding a Custom item
Could use player inventories and check the item meta
Check if item meta matches the custom item meta
will compare amounts tho so be careful like 64 dirt != 1 dirt
Is it possible to delete a standard minecraft recipe?
Does the EntityChangeBlockEvent get called when it goes from solid -> entity
Yes. Just remove it from Bukkit#recipeIterator
Wdym when? as long as the target exists you can send it
no
ok... it seems to be but idk
Called when any Entity changes a block and a more specific event is not available.
you tested that?
yeah
sand
haha, no
I'm making a plugin that uses fake entities. I need to apply a skin on them and I need to tell the player that see the fake entity to render the skin second layer. I thought that I would have achieved that through sending a metadata packet but it doesn't work. https://paste.md-5.net/igokokopen.cs
show more code
does that even work you have too many brackets
just an fyi that last replace is outside of the CC.translate() brackets
Well that code tells me nothing
In a minute I will post the real code, wait
?paste
ill try args[0]
you should be getting an error on that call tho
protip
put each .replace on a new line
that way you don't fuck up the parentheses as horribly
I hate that formatting
@chrome beacon I don't think that you saw the message. So I'm pinging you, hope you don't mind
thanks, i think its working
So where are you setting the skin layer data?
Also I'd recommend making your life easier by using Citizens
This only for personal education porpoises.
line 8
That's the skin not layers
Yeah you're not setting the layer data
You're on your own with NMS
What do you mean?
Find that yourself I don't feel like spending time to decompile and look through NMS
Well the data is in the Entity Metapacket and is in a byte
What I don't get it here is that the second layer is inside the skin data
That's from what you sent earlier
how does this look?
thanks xd
looks pretty good
is that for youtube ranks or something?
So, i am trying to make a plugin that makes the tnt explosion look more realistic, however i have hit a bit of a wall. I want to make it so that when the FALLING_BLOCK hits the ground it persists for a bit. I am spawning these blocks by looping thru every affected block in the ExplodeEvent and then making a block with its texture. The problem is that, in order to stop them from despawning i have to use packets to intercept the ENTITY_DESTROY packet and cancelling it.
I am using the EntityChangeBlockEvent and then , if the id of the entity is in the set i cancel the event, causing it to destroy the entity but i then just cancel the event.
Then, the problem was that the falling blocks' velocity persists so i am now sending a packet to cancel their velocity when they land:
@EventHandler
public void onBlockChange(final EntityChangeBlockEvent event) {
final int id = event.getEntity().getEntityId();
if (this.blockIDs.remove(id)) {
event.setCancelled(true);
cancelVelocity(id);
}
}
public void cancelVelocity(int id) {
final PacketContainer veloctiyPacket = new PacketContainer(Server.ENTITY_VELOCITY);
veloctiyPacket.getIntegers()
.write(0, id)
.write(1, (int) (0 * 8000.0D))
.write(2, (int) (0 * 8000.0D))
.write(3, (int) (0 * 8000.0D));
Bukkit.getOnlinePlayers().forEach(player -> {
try {
RealPhysics.this.protocolManager.sendServerPacket(player, veloctiyPacket);
} catch (final InvocationTargetException e) {
e.printStackTrace();
}
});
}
Which works for most of the entities, it is just that not all of them obey this new vector. I will attach an example
yeah also a streaming command for streamers
nice
Most of them work, just not all of them. Also, as a test i added some debugging output when i make, and when they land and i found these Discrepancies:
Where the left are the ones i made and the right are the ones detected
define detected
by the listener
EntityChangeBlockEvent
I can't even think of a jank way to fix it tbh
you got any of the ideas @wraith rapids
ik you have some great ones
oh, and btw i tried to tp the blocks donw by 0.1, but it just caused a lot of issues of them rubber banding everywhere
oh i just realised that i overlooked sommin
so the ones missing on the right are the ones that you spawned but never cancelled the destroy packet for and never heard the event for
i have a big proyect and so far i have been dragging and uploading files to github, but now it says try with less than 100 files, how can i upload it without having to slipt it into more parts
but you said the event doesn't fire
but didn't detect on the listener
you cancel the packet on the listener, yes?
yea
u realise that multiplying by 0 just makes it 0 right
do i create a new file and upload each part?
i mean, you add the eid to the set of to-be-dropped destroy packets
unless that's ids idk
yeah bit they are client side
ah
i overlooked that if another tnt goes off next to them, they move anyways
cause it induces a velocity in them
so the issue isn't that the packet doesn't get sent or applied properly
it's that the event isn't being fired for the entity
if you use paper, listen to entity remove from world event
I never detect it landing
oh I'm blind that's meant to cancel velocity
yeah
<
hook the cancel velocity logic into the packet listener
rather than the event listener
that way it'll fire no matter how the entity is destroyed
event or otherwise
true
soo, lemme get this straight
i dont use paper
so
i could add to the packet listener
to cancel the velocity
my guess is that the ones that aren't caught by your event like die and drop an item or something
which won't fire the entity block shit event
because no block would form
true
test it by blowing something up over a floor of torches
all of the entities should then fail to get the velocity applied
because none of them fire the event
i was looking at an open source code and found this
OutlinePane background = new OutlinePane(0, 0, 9, gui.getRows(), Pane.Priority.LOWEST);
background.addItem(new GuiItem(createGuiItem(material, "" + ChatColor.RESET, false)));
background.setRepeat(true);
gui.addPane(background);
}```
could someone explain what
OutlinePane
setRepeat
addPane
is?
thanks
cant find it in the docs
What is this for
They aren't in the docs
Looks like some kid of third party api
import com.github.stefvanschie.inventoryframework.gui.type.ChestGui;
import com.github.stefvanschie.inventoryframework.pane.OutlinePane;
import com.github.stefvanschie.inventoryframework.pane.Pane;```
ah that makes sense
creditable guy
so i could import that and use it?
you should ping him in the paper discord repeatedly
if i add it in the maven dependency
yes
ur exactly correct @wraith rapids
none would form
Wow your genius shocks me
do you know if there is anything i can do about it?
hook the velocity shit into the packet interceptor
does getServer().getWorld(getServer().getName()) work in the onEnable method to find the main world of a basic server.pro server?
might want to cancel the events that fire when the entities die on top of torches and shit
i have no clue
as they will be dropping items
fallingBlock.setDropItem(false);
😄
So, when i get the destroy packet in, i need to send a velocity packet?
surely there needs to be a delay though?
Try it and see
Hi!, how can I get the players of a certain server, what I mean is: I have a ServerSelector that when I put %online% it shows the players of the indicated server
pretty sure that's some plugin messaging stuff, hold on a sec
pog
Hi everyone. I have a bungercord servers. My issue is: if I add a player tag with team, others can see it in others servers? (as TabList and player displayed name)
bump
can't find it nvm
apparently I lied I found it @sturdy elk https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
scroll down to PlayerCount
That's not going to work
Well I doubt your world has the name of the server implementation
getServer().getWorlds(0) i believe
getWorlds().get(0)
Can anyone help me send private msg
what
whats a fancy way of making a debugmode? i currently have a
if(Main.getconfig.getBoolean("config.debugMode") sout("the info here")```
but i dont really like that its too long
so i have a
return new Config().getDebugMode();
}```
and use if(debugMode()) sout("info")
but theni have to add the debugMode() to every class where i want debug mode to be used
add a getter to your main java public boolean isDebug()
yep
ah thats such a simple solution thanks
ty
Hello, how can I spawn enderdragon with bossbar?
you could make an entity enderdragon and a bossbar
Hello, how can I create a new Item set?
a list of item stacks
new HashSet<ItemStack>()
or Item if that's what you really want but that's probably not what you really want
I want like an armor to be in the same set
and if you have all pieces you would have some extra powers
Sound like you are looking for a plugin not some programming help
mmoitems is a plugin
yeah i know
then you are after #help-server not #help-development
np
When I'm spawning enderdragon by spawnEntity() and making getBossBar.setVisible(true), bossbar still isn't visible
Bukkit.createInventory
and InventoryHolder
You create your own class with your own inventory and have the player open it.
<> around links and it does no inserts
Guys, probably dumb question, but how much NMS stuff will not work on paper?
it is touched
Can someone help me?
recently they broke one of my hooks as they replaced the built in message components with a custom one of theirs
is that nms though?
that's not nms no
Ok, thanks.
paper uses adventure for the component api
the underlying doodads are still almost entirely the same
most nms shit will work on paper but there are some differences
especially surrounding timings
They don’t enforce the usage of adventure components
idk it's about time for someone to unify the chat component shit in the api
No one can help?
is it an error for intellij to mark my main class(the one with the onEnable) as never used?
latest update has made it so legacy components show a warning in console
yeah they are definitely pushing towards adventure pretty hard
yes
hello where can i see what i buyed on spigot?
but imo there is no reason to stay with bungee components anyway
beyond like not having to update your code
that means I can ignore it, and my plugin will work as intended, right?
yup
Yeah a warning but still isn’t what I would call enforcement
that error is pretty annoying when designing apis and any other decoupled programs or libs
can just ignore it
i've disabled the "x is not used" warning in ij because it's literally always useless
according to the kid complaining it was lagging his server
private void moveDown(int id) {
final PacketContainer testPacket = new PacketContainer(Server.REL_ENTITY_MOVE);
testPacket.getIntegers()
.write(0, id);
testPacket.getShorts()
.write(0, (short) 0)
.write(1, (short) -409.6)
.write(2, (short) 0);
testPacket.getBooleans()
.write(0,false);
Bukkit.getOnlinePlayers().forEach(player -> {
try {
RealPhysics.this.protocolManager.sendServerPacket(player, testPacket);
} catch (final InvocationTargetException e) {
e.printStackTrace();
}
});
}
This packet moves a block down by 0.1, however it does it based on the position it was spawned at
which i hate - cause it stupid
How have you done it?
that's strange
although actually
it does make sense
it would be pretty strange if it worked the other way around
yeah you're kind of fucked i guess
i guess you could record the location where the sand lands at in a map or something
and just use absolute teleports
yeah
or i could just let them get removed with the random amount i already have - idk
idrk what it is doing tbh
discrepancies from the multiple explosions most likely
i don't think tracking their location is feasible
probably just need to give up on the idea
Yeah, i think that is good enough
i would like to make some sorta curve
For their removal
curve?
Like this
gaussian distribution of thei lifespan?
so there is a low chance of a high or a low despawn time
i mean, thats a bell curve
but ig, idk what the gaussian looks like
yeah but the distribution is called a normal or gaussian distribution
it makes a bell curve when you graph it as value vs probability
Random::nextGaussian
oohhhhhh that makes sense
ok
So does that return a value from 0-1
or what
i can google it tbh
Hmmm, the only thing is that the Gaussian function returns -
values
So ig i have to +1 to all
it returns a random gaussian with a standard deviation of 1
meaning that the practical range of the values it shits out is from -3 to 3, more or less
ohhh
if you want to make the range larger, you multiply the result
if you want to shift the range, you add/subtract
if you want a random value between 20 and 60 seconds, you add 40 and multiply by like 10 or something
of course since it's a gaussian it doesn't really have a max or a min limit
it could be fifty billion
the probability is just low
ill show what i am doing rn
so you'll want to throw some Math.min and max at it
int delay = (int) (Math.floor(Math.random()*(80-50+1)+50));
Bukkit.getScheduler().runTaskLater(this, pending::destroy, delay);
so i just need to provide a tick delay
Cause whenever i need to make a new block, i instanciate the PendingBlock
which has methods create and destroy
Math.min(Math.max((ThreadLocalRandom.current().nextGaussian() * 20) + 60, 1), 300)
random value ranging from 1 ticks to around 120 ticks, mostly centered around 60 ticks
with a slight relative bump in probability at 1 ticks and 300 ticks but those are mostly negligible
dose anyone know why the console would return this as null?
because it's null
<
I am sometimes having the blocks form
which is cringe
but i am considering labelling it a 'feature'
but idk
i don't like it
Basically, for whatever reason the EID isn't in the set
As in for a player ?
to their skin?
You don’t need the == false
You can just use !
In Boolean logic (in Java) it means not
For example, if (!exampleBoolean) {
is the same as if (exampleBoolean == false) {
i don't think that is how it works
If you’re checking if the Boolean is true you don’t need ! or == true
do you know @cinder thistle
I’m sure thread safety is stupid, I’m sure
So it must be possible to write async code without it
Nope
It wasn’t a joke
well
It was sarcasm
yeah
omg wow!
everything on one async thread
Just because you think something must be possible, doesn’t mean it is
Does that satisfy you
Have I gone crazy or is modifying a cloned item from a packet somehow modifying the original as well
but arent you setting it back
I should be setting it to the cloned item
is there a way to grab the plugin version from plugin.yml?
@wraith rapids thanks
I must be doing a dumb here
is there an egg for redisbungee on pterodactyl?
i think you might have to boil the egg for it to be edible, unfortunately
Is it theoretically possible for an EID to change?
okaayy
lets try my luck
btw is there somewhere an tutorial wiki to install redis? all i found https://github.com/minecrafter/redisbungee
Hi, does anyone know how to do multi line placeholders (or variable number of lines rather) when setting up your own placeholder with Placeholder API
\n?
I'm more thinking for people to use with scoreboards
So this can be a little weird
you could just have %plugin_top_[1-10]%
That’s like ancient
is depositing money via vault laggy on the server? or does it depend entirely on the economy provider?
And also I believe there is a tutorial on how to install redis on their site
Anybody know how to work with WorldGuard?
they have a discord
Will this allow the line to be omitted from the scoreboard if they don't exist?
where they are mean
They have an api documentation also awesome dude
I'm assuming for people using featherbaord
I know
But it isn't really helping me
I need to disable block-place and block-break, except for a few items (wool, oak planks, that stuff)
How do I make it so when a command is ran and a boolean value is false it gets set to true and then a specific text is saved in a data.yml when its trrue?
anybody
I think you have to add a config.yml file to your package
yes
... no shit
Event listeners
How do i save it after adding changes while keeping comments
With world guard
Lol, anybody you know I could ask?
kk
help plz
with?
how to get title of inv?
event.getView
ty
PlayerDeathEvent
please don't find your desired inventory with the title
so?
also possible to give a colored name
still very janky.
(unless people got some sort of a /rename cmd on ur server)
yeah true, your method is probally better.
same way you don't want to check for a custom item via the lore
After doing some digging in this discord I have discovered it only happens in creative mode, weird
I wonder if @lost matrix ever found a solution to this <#help-development message>
public void clickEvent(InventoryClickEvent e){
//
if(e.getView().getTitle().equals("plots menu")){
Player player = (Player) e.getWhoClicked();
switch(e.getCurrentItem().getType()){
case DIAMOND_SWORD:
player.closeInventory();
player.setHealth(0.0);
player.sendMessage("You just killed yourself");
break;
}
e.setCancelled(true);
}
}```
is that ok?
some one?
yeah it is but just check if the e.getCurrentItem() isnt null
default:
e.setCancelled(true);
break; ```
nope
i meant before the switch
oh
if currentItem is null it will throw an error if you try to getType
@EventHandler
public void clickEvent(InventoryClickEvent e){
//
if(e.getView().getTitle().equals("plots menu")){
Player player = (Player) e.getWhoClicked();
if (e.getCurrentItem() == null)
return;
switch(e.getCurrentItem().getType()){
case DIAMOND_SWORD:
player.closeInventory();
player.setHealth(0.0);
player.sendMessage("You just killed yourself");
break;
}
e.setCancelled(true);
}
}
Basically
don't use the inventory title to compare inventories