#help-development
1 messages · Page 907 of 1
it says command not found
me?
oh no i mean in the discord server
could be
might be overriding your velocity in the same tick
so would i have to cancel the velocity
then wait 1 tick
and then set?
also how do u cancel velocity
just set each thing to 0
?
that would then be overidden in the same way ;d
yup
should work tbh
i can send the entire block of code if u want
ive done it as well without a delay
hm
ok
Which version are you on ?
So have you tried delaying by a tick the velocity ?
Maybe the damage trick the velocity
ah i see
I mean maybe there is some kind of perturbation between the two
u need to place it in a runnable @plucky rock
hm
It reminds me when we tried to fix the knockback system in 1.6/1.7 because players were not happy and said it wasdisadvantaging some
We had to delay the velocity
wdym sry im a bit new to this
like a BukkitRunnable?
yea
ah ok
?scheduler
on how to use them?
ty
u want the one about " running task the next tick"
ok
oh bruh its 12 AM
lmao
imma sleep ill come back to this tmmrw
thc for the help
Night will help you sort everything ahah
lol
Well a MethodHandle is coupled with reflection, at least on some recent versions, the jvm is able to look through them transparantly
.unreflect goes hard
never used those to be honest
Is there a way to convert plugin into the intelij idea project?
What do you mean ?
I think he's talking about decompiling a jar
you can decompile a plugin but its a bit of a pain sometimes. Do you not have the original source?
Yeah
are u use runnables to set gui items?
like if i want to set all slots of gui to a stained glass
it be very pain to do it 1 by 1
use a for loop
why is it giving error
i think your arguments are flipped
@EventHandler
public void onRightClick(PlayerInteractEvent event) throws IOException {
if(event.getAction().isRightClick()){
if(Objects.requireNonNull(Objects.requireNonNull(event.getItem()).getItemMeta().displayName()).toString().contains("Skyblock Menu")){
SkyblockMenu.createSkyblockMenu(event.getPlayer());
}
}
}
}```
i used them for an old event bus years ago
https://paste.md-5.net/iratagitih.java @tardy delta :p
registerEvents, not registerEvent
@quaint mantle
registerEvents(new ItemRightClick(), this);
@anyone please i need helppp
@agile anvil sorry to disturb you
but i need help
cant i get help until i get verified??
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
ok
so i dont know whats wrong
the problem i am having is, my plugin is not showing up in the server
when i do /plugins
what does the server log say
?paste
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
ah his plugin is of paper
no its spigot
are u using core paper?
whats that?
server of Paper
yes
the server is paper
but the plugin is spigot
uhhh
is anyone here??
try a spigot server and see if you still have the same issue
whats it used for?
looks like an invocation handler to me
ok
if i setup an sqlite database, do i need to make the .db file accessible in the plugins folder or can it be stored in the jar file?
The latter should work, no?
And if not, how exactly would I add the file as a datasource in intellij, since i can't know the path where the end user will store the plugin file
this is what I had in mind (I created a custom chance system)
it's a target-like random system (in the middle, where 100% is written, it's actually around 90%)
could remind you of a gun spray (recoil). The middle section is more likely to be chosen than red section.
Eg.:
(its possible that 5% or less out of 100 tries, that section will be chosen)
15% means you have a 15% chance every 100 tries to have that section chosen
(its possible that 15% or less out of 100 tries, that section will be chosen)
50% means you have a 50% chance every 100 tries to have that section chosen
(its possible that 50% or less out of 100 tries, that section will be chosen)
90% means you have a 90% chance every 100 tries to have that section chosen
(its possible that 90% or less out of 100 tries, that section will be chosen)```
you can't keep it in the .jar because you can't write to the .jar as it is open
you can just make a new .db file and sqlite will handle it afaik
tbh makes sense
so i just add it as a datasource with the path jdbc:sqlite:MyServerdatabase.db?
sure
just calls methods yeah
event bus with similar register to bukkits
@Register
void doEvent(TheEvent event) { /* stuff */ }```
i probably wouldve written an annotation processor for that
In case of dependencies for bungeecord, this is the last build?
https://oss.sonatype.org/#nexus-search;quick~bungeecord
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.20-R0.2</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.20-R0.2</version>
<type>javadoc</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>```
I'm using FlameCord 1.9.6 by LinsaFTW build not directly BC
strategy pattern is useful
Strategy pattern is good for ocp
public interface Engine
{
public void Move();
}
public class GasEngine : Engine
{
public void Move()
{
Console.WriteLine("Поехали на бензине");
}
}
public class ElectricEngine : Engine
{
public void Move()
{
Console.WriteLine("Поехали на электричестве.");
}
}
public class Car
{
private int seats;
private string brand;
private Engine engine;
public Car(int seats, string brand)
{
this.seats = seats;
this.brand = brand;
this.engine = new GasEngine();
}
public void SetEngine(Engine engine)
{
this.engine = engine;
}
public void Move()
{
engine.Move();
}
}
public static void Main()
{
// Strategy
Car tesla = new Car(5, "Tesla");
tesla.SetEngine(new ElectricEngine());
tesla.Move();
}```
no way
is that the thing?
or should engine part be only in constructor
without changing at runtime with SetEngine?
You should have everything in the constructor that the object needs to have
If it works without you could consider not havong it in the constructor
example code on the internet
creates a field for changing engine at runtime
and idk why
oh i see
Thats the strategy pattern
changing strategy at runtime
Yes
?
I now use this to set an item to the result slot of the anvil. The only thing is it isnt visable until I click on the slot and pick it up. How is that fixable?
AnvilInventory anvilInventory = (AnvilInventory) event.getInventory();
anvilInventory.setItem(2, resultItem);
call Player#updateInventory ig
Don't you need to like update it or am I thinking of something else
Il try
Tell me if I am doing it wrong, but adding this doesnt work
AnvilInventory anvilInventory = (AnvilInventory) event.getInventory();
anvilInventory.setItem(2, resultItem);
Player player = (Player) event.getWhoClicked();
player.updateInventory();
Hey,
what event (handler/callback) for BungeeCord will be the best to catch player IP and send POST request before player will be redirected to the main server?
Is there a way to hold the redirection in time to get a response previously sent request?
I wish to register user IP before redirect to main server/lobby.
Is there a way to artificially create connection between nether portals?
Like in vanilla minecraft but using plugin
What r u trying to do?
Is there any way to tag an item with some kind of identifiable data but still allow it to stack with other items of the same type?
I really doubt it but I'm asking anyway
you'd probably need to rewrite how portals work then
how are you going to disguise it from other items then
since inventory would just pass it to itemstack[] anyways
Yeah idk for some reason I thought it was possible in my head until I actually started working on it 🤦♂️
There is a core that doesnt support mob teleport using nether portals im trying to make it using plugin
how do i create a levelled variable
cant assign an int value to levelled then how can I assign a value to levelled variable?
wdym by levelled
open closed principle
oh no
Aye i'd have it where there is a portal manager that, when a TP occurs, it grabs the location of the portal they tp'd from, and checks it via a Map<Location, CustomPortal>, where the CustomPortal is an interface that has "getAlternateTpLocation" or something.
That way you could use that interface to make linked portals, portals that can link to several portals and chooses one randomly , one that TP's to a pre-set location (star gate style) etc etc
want to make a plugin that changes the composter level to 8 as soon as the composter level is greater than 1
bcz composters are too slow in vanilla
I promise your efficiency would go up a lot if you worried less about programming paradigms lol
Keep them in mind, don't treat them like sacred, all-knowing texts
Legit. Only ones I use frequently are Singletons, Builders and Decorators.
And even then you have to have the big brain to go away from the verbatim pattern if theres a slight alternative version that suits ya needs 😄
insta broken
but but but
MONOMOTH MONOMOTH MONOMOTH
it's IDIOMATIC
You mean idiotic
wanna abuse some statics with me?
I usually write smth shitty and then say to myself. Do i need to care? Then get lazy and just leave it
So its better to keep it in mind if ur lazy
Internal Exception: ic.netty.handler.codec.DecoderException: javalang.Index0utOfBoundsException: readerIndex 2) + length 8) exceeds writerIndex 2): PooledUnsafeDirectByteByfCridx: 2, widx: 2, cap: 2what can this error mean?
U probably messed up some packet
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player p = event.getPlayer();
if (p.getLocation().getChunk().equals(Npc.nurseChunk)) {
for (Entity entity : p.getLocation().getChunk().getEntities()) {
if (entity instanceof Player) {
try {
System.out.print("ff");
EntityPlayer e = EntityNurse.create("Nurse", Npc.plugin.getServer().getWorld(Npc.plugin.getConfig().get("world").toString()), new Location(Npc.plugin.getServer().getWorld(Npc.plugin.getConfig().get("world").toString()), Double.parseDouble(Npc.plugin.getConfig().get("nurse").toString().split("\\s+")[0]), Double.parseDouble(Npc.plugin.getConfig().get("nurse").toString().split("\\s+")[1]), Double.parseDouble(Npc.plugin.getConfig().get("nurse").toString().split("\\s+")[2])));
entity.teleport(e.getBukkitEntity().getLocation());
PlayerConnection connection = ((CraftPlayer) entity).getHandle().playerConnection;
PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, e);
PacketPlayOutNamedEntitySpawn spawn = new PacketPlayOutNamedEntitySpawn();
connection.sendPacket(info);
connection.sendPacket(spawn);
connection.sendPacket(new PacketPlayOutEntityHeadRotation(((CraftPlayer) entity).getHandle(), (byte) ((e.getBukkitEntity().getLocation().getYaw() * 256f) / 360f)));
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, e));
} catch (IOException er) {
er.printStackTrace();
}
}
}
}
}``` I check if the player is in the npc chunk and load it
can you like... not parse the nurse 3 times
well yes
i would advize you to not use PlayerMoveEvent for this.
and if you insist at least filter out only mouse movements
what would you recommend using instead?
a repeating runnable
seems like it doesnt have to be instant. so u can just check every second
No it's perfectly fine
you can just check if the chunks are diff
do x >> 16 z >> 16 and compare
that would work as well
4, not 16
You're gonna end up with 0 in most cases if you use >> 16 lol
I need to compare whether the fragment I am in is a fragment of the npc, what does it mean to compare whether the chunks are different?
Yeah it was / 16 and >> 4
my bad lol
check x and z coords, if they are the same then you're in the same chunk
but will this solve the error?
.
probably not, but will prevent you from absolutely destroying your server's tps
what does this error mean and what can be done to solve it?
Some data you're passing is too big for what the packet is expecting
that's all the info basically
Learn how to shift them bits nerd 😎
I counted wrong let me beee
condition if (p.getLocation().getChunk().getX() >> 4 == Npc.nurseChunk.getX() >> 4 && p.getLocation().getChunk().getZ() >> 4 == Npc.nurseChunk.getZ()) { nurseChunk = new Location(Npc.plugin.getServer().getWorld(Npc.plugin.getConfig().get("world").toString()), Double.parseDouble(Npc.plugin.getConfig().get("nurse").toString().split("\\s+")[0]), Double.parseDouble(Npc.plugin.getConfig().get("nurse").toString().split("\\s+")[1]), Double.parseDouble(Npc.plugin.getConfig().get("nurse").toString().split("\\s+")[2])).getChunk(); config.yml nurse: -188 64 -26
no I-
you use the player's X and Z
not the player's chunk X and Z
that avoids getting the chunk
also store the location as it makes a copy each time
the spawn npc fake entity coordinates are different from those in the game
i mean the chunk is already loaded so it's not an expensive op to get it
It's extra
it's a non issue
also Npc.plugin.getConfig().getString("nurse").split("\\s+") you can store this
(you can use getString instead of get)
when I write /tp and insert the coordinates, it teleports me to a completely different place
I want to make it so composter gets filled as soon as its level is greater than 1 but blockLevelData.setLevel() isn't working and composter doesnt get filled when its level is greater than 1
I am pretty sure you need to call update on the blockLevelData
if ((int) p.getLocation().getX() >> 4 == Npc.nurseChunk.getX() && (int) p.getLocation().getZ() >> 4 == Npc.nurseChunk.getZ()) {?
how do i call update
yep, though don't call getLocation twice as that makes two objects
let me find it 1s
alright thanks
thanks
I was just trolling a little bit as it became somewhat of a meme
I have this weird bug where players are invisble after logging out and back in. I found it due to another bug where the color of the player name in the tab and above them would not update unless relogging (but the name in the chat would have the appropriate color without relogging). At no point in my plugin do I make players invisble (other than spectator mode but players arent in spectator mode when rejoining, its survival). Players will be visible again if they or the person viewing them dies. Anyone ever had something similar happen?
I want to constantly giving health_boost to player without reset their health value how may I do this?
How to get nearest block with certain type using location?
something like location.getNearestBlock(type)
You could check all 6 adjacent blocks for their type, and when all of them don´t match the target, mark them as visited, and then recursively call the function again for all 6 blocks. When the block tested is visited, you skip it and repeat until some block matches the material
Not going to be fun on the server unless you cap a distance
Anyways if you insist on not capping it you'll want to make ChunkSnapshots and do what the above post said iteratively and asynchronously so you don't crash your server
Iteratively so you don't fill the call stack asynchronously so you don't freeze the main thread
This doesnt work. Why? Iam just trying to get a debug message if a book is enchanted for now.
@EventHandler
public void onEnchantItem(EnchantItemEvent event) {
ItemStack enchantedItem = event.getItem();
if (enchantedItem.getType() == Material.ENCHANTED_BOOK)
ChunkSnapshots can't be made on another thread so you need to make a work distribution system.
?workdistro
Check for a regular book you can't enchant an enchanted book
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player p = event.getPlayer();
if ((int) p.getLocation().getX() >> 4 == Npc.nurseChunk.getX() && (int) p.getLocation().getZ() >> 4 == Npc.nurseChunk.getZ()) {
for (Entity entity : p.getLocation().getChunk().getEntities()) {
if (entity instanceof Player) {
try {
if (!Npc.nurseSpawned) {
EntityPlayer e = EntityNurse.create("Nurse", Npc.plugin.getServer().getWorld(Npc.plugin.getConfig().get("world").toString()), new Location(Npc.plugin.getServer().getWorld(Npc.plugin.getConfig().get("world").toString()), Double.parseDouble(Npc.plugin.getConfig().get("nurse").toString().split("\\s+")[0]), Double.parseDouble(Npc.plugin.getConfig().get("nurse").toString().split("\\s+")[1]), Double.parseDouble(Npc.plugin.getConfig().get("nurse").toString().split("\\s+")[2])));
PlayerConnection connection = ((CraftPlayer) entity).getHandle().playerConnection;
PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, e);
connection.sendPacket(info);
connection.sendPacket(new PacketPlayOutEntityHeadRotation(((CraftPlayer) entity).getHandle(), (byte) ((e.getBukkitEntity().getLocation().getYaw() * 256f) / 360f)));
Npc.nurseSpawned = true;
}
} catch (IOException er) {
er.printStackTrace();
}
}
}
}
}``` now there are two problems, the entitydamagebyentityevent event has stopped working, where I process the event clicking on the npc and the npc appears only when I go up to the npc chunk, then go far away and enter the chunk again
Yeah, I will cap a distance but is there any way to do it?
See above post by cat
Okay if I put in book then it gives an console error on this: EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) enchantedItem.getItemMeta(); Since it is a book and not an enchanted book
?
Well yeah it has no enchantment storage yet
What are you trying to do
Some additional info for this I discovered: The cause seems to be related to the player being teleported to a different world right when they join. If I dont do this and instead have them log in back in the main world and then have a player teleport them, they will be visible. So for some reason players are invisible when teleporting them on login to a world thats different to the one that they logged out in. Is this a known issue perhaps? I cant find anything specific about this
any event to get player's left and right click separately?
How do ppl save minigame maps?
PlayerInteractEvent
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
At work we stored them in mongodb buckets
whats the difference between main hand and whatever is the other hand?
Uploading a zip into bytes
You have 2 hands
Left and right
:(
Main is right off is left or vice versa
Main is the one that usually has the most “actions”
do they work as left and right mouse click?
I download them from s3 storage 😭 🙏
Main is the one with the pickaxe ability
so attack is main?
I doubt about nurseSpawned whether I need to invoke it only once, anyway it doesn't disappear.
can someone help me with this?
Yes
and placing blocks?
oh i see
Offhand can place some blocks
It could be both lol
bruh
I usually use offhand so lo
ok let me test
You can't dictate between left and right click
If that's what you're trying
I mean you can for certain actions
i want something to happen when player uses right click only not left click
E.g. Action RIGHT_CLICK_BLCOK
You need to read the methods avaliable to you for that event
There is a click action
Which specifies type of click
oh alright
I removed the nurseSpawned condition and it just spammed the npc how do I spawn the npc only when the player is next to the npc
for example, add a condition that checks whether an entity is in a chunk
Im trying to add one of my custom enchantments to a book when it gets enchanted. This is the furthest I have come:
if (enchantedItem.getType() == Material.BOOK) {
ItemMeta meta = enchantedItem.getItemMeta();
if (meta != null) {
List<String> lore = meta.getLore();
if (lore == null) {
lore = new ArrayList<>();
}
lore.add(ChatColor.GRAY + "Test Lore");
meta.setLore(lore);
enchantedItem.setItemMeta(meta);
}
}
But now I need to add the enchantment. Or for the test any enchantment.
How can I send a message to ALL players on the Server that have the permisson "group.mod"?
Code:
@EventHandler
public void onPlayerSendMessage(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
String message = event.getMessage();
//And here the Message to the players: "test"
}
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.hasPermission("group.mod")) {
player.sendMessage(message);
}
}
something like that
Bukkit.broadcast("blah", "group.mod") :p
how can i add local .jar maven dependency?
Sometimes you have a certain .jar file that you need as dependency, but the author of that .jar was too lazy to properly upload it to a public repository. That’s bad, but not a problem. There are two ways to solve this, but only one proper way. The proper way: install the dependency The proper...
thx
you'd probably be looking for InventoryClickEvent on the enchantment table result slot
Ok thank you
where i have to use this cmd?
any way to manipulate the drop i get after i fill up a composter?
doesn't look like it well atleast easily. You probably want to use PlayerInteractEvent. Check for a right click on a composter check if the composter is going to fill after the right click with the given values and then spawn your item
looks like there is little to no API surrounding the composter
maybe I could fix that 🤔 maybe if I get around to it
who be pingingme
@remote swallow i did (jk)
kek
does one of yall know how to make a npc that opens a control panel to tp to multiple worlds with znpcs and multiverse
I would just grab something like deluxe menus and make a menu
Then set the npc to open the menu
why intelji think what object can be null in 1 method ? - https://paste.md-5.net/ubaguxurep.java
if i check it
enu?
but 2 method not send warning
IntelliJ isn't smart enough to know that method 1 actually verifies it's not null
You're also throwing NPE which feels a bit weird
Isn't it basically doing what would happen anyway
Pretty much, if I use an isNull method and it throws an NPE if it's null I would be sad
Is it good practice to throw exceptions for null in set methods or is it better to do nothing?
Depends
please help. the npc appears only when I go up to the npc chunk, then go far away and enter the chunk again java private static CraftPlayer hasEntityPlayer(Chunk chunk) throws IOException { for (Entity entity : chunk.getEntities()) { if (entity.getCustomName() != null && entity.getCustomName()=="nurse") { System.out.println("1"); return (CraftPlayer) entity; } } return null; } @EventHandler public void onPlayerMove(PlayerMoveEvent event) throws IOException { Player p = event.getPlayer(); if ((int) p.getLocation().getX() >> 4 == Npc.nurseChunk.getX() && (int) p.getLocation().getZ() >> 4 == Npc.nurseChunk.getZ()) { CraftPlayer ep = hasEntityPlayer(p.getLocation().getChunk()); if (ep == null) { for (Entity pe : p.getLocation().getChunk().getEntities()) { if (pe instanceof Player) { System.out.println("fdfdf"); EntityPlayer entity = EntityNurse.create("Nurse", Npc.plugin.getServer().getWorld(Npc.plugin.getConfig().get("world").toString()), new Location(Npc.plugin.getServer().getWorld(Npc.plugin.getConfig().get("world").toString()), x, y, z)); PlayerConnection connection = ((CraftPlayer) pe).getHandle().playerConnection; PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entity); connection.sendPacket(info); } } } } }
so
NPCs appear to only spawn when player enters a "chunk"
maybe it's because I have an npc CLIENTBOUND?
You only send the packet when the Player is in the nurse chunk, you could try sending it without this check
I have this in the pom.xml but cannot find the net.minecraft packages or even use NMS
It will only make it worse, I think.
You should be sending it as soon as they are in tracking range
did you run buildtools for 1.17.1
yes
my other projects can use that but for this nope
I didn't figure out. how to do it?
are you using java 17 or newer? check file -> project structure -> project sdk (or however it's called)
maybe player#showPlayer?
Thanks!
what happens if you import a random NMS class and then just compile anyway?
import net.minecraft.core.BlockPosition;
if it works fine, it's just IJ being weird
btw why are you not using mojang maps?
hmm it took a little while to set up and just I'm lazy :l
try to just import the class I mentioned, then run mvn package and see if it compiles
entity-tracking-range What is he responsible for?
hmm it doesn't show on autocomplete but on Alt+Enter?
weirds
your plugin still contains it then, have you ran mvn clean before compiling again (or gradlew clean when using gradle)?
could this be related to the problem above?
(entity-tracking-range)
sometimes IJ takes a while to index all that stuff
but you should really check out mojang mappings - they'll save you hours of time in the future
what's the purpose of that code? you spam the "spawn npc" packet every time a player moves inside the NPCs chunk
and you never send it when the player is inside another chunk
and you spam it to all players within that chunk, instead of only to the player who moved
Yeh some of my big project does use that for readability but for smaller nope :l
I send the packet to the player inside this chunk only when the npc is not spawned in the chunk and not "spam" with packets
if (ep == null) {```
I doubt that hasEntityPlayer will work fine, as you're comparing strings with ==
I changed it to equals and now I'm sending the packet only to the player who is moving, what else could you recommend?
show your onEnable and onLoad methods
Replace the chuck check with a distance check, if the distance between player and npc is less than the entity tracking distance, show the npc
any idea why this doesn't work?
Inventory inventory;
public void openItemBrowser(Player player){
inventory = Bukkit.createInventory(null, 54, ChatColor.GOLD + "Item creator");
player.openInventory(inventory);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getInventory().equals(inventory)){
event.getWhoClicked().sendMessage("equal");
}
else{
event.getWhoClicked().sendMessage("not equal");
}
}
this displays "not equal".
imma try that
nah doesn't seem to work
i don't like it being static but ig it will stay like that for a bit
Do you register the event handler with a different instance than you call openItemBrowser with
Is it a good practice to rewrite the code and switch to implementing interfaces)?
literally everything
it depends on what it is
if the plugin has an api some stuff can become interfaces but not everything has to be an interface, if theres no api not really
Well, in short, connect it as deluxeMenu, but with the API I would like to add the ability to create your own menus
depends how you expect it to be used, if its just configs only it doesnt really need interfaces, if other plugins might interact maybe a few
I just look at objects and perceive them as 1 implementation of a common functionality
this is more like an idea to add the ability to create your own menu implementations, because at the end I look and see that my manager class creates only general logic...
and apparently will have to be remade for interfaces
getServer().getPluginManager().registerEvents(new ItemBrowser(), this);
ItemBrowser.getInstance().openItemBrowser(player);
o wait you might be right
yeah now it works
ty
Pretty sure it's PlayerMoveEvent
How to clone entity?
https://paste.gg/p/anonymous/23b5a488e36641f6840d76f14b6cb8da I am trying to create an npc using nms, without citizens. can anyone help with improving this code (suggest what can be changed and I'm sure something is wrong with playermoveevent) (1.12.2)
👍
Why do entity has no remove() method?
it does
Entity#copyTo
oh
First of all create a variable for this
and any other redudant code
done
what should I do with playermoveevent
does my code make sense?
in this event
is it possible to change something?
yes
that's a really cursed line lol
but sometimes need to re-logging
then send remove player and only then add player
remove player packet?
yes
entity.copy is unstable, is it normal?
If I remove the PlayerMoveEvent code, will the NPC still function properly when moving to a distant location and returning?
is there a better way to do this?
and I didn't understand when I should send this packet
I don't think you understand
the npc isn't there
you're just spoofing it to the player
so that he thinks a player is there
but anyway, just check it with distance and once he's out of range and later comes back spoof the packets again
that is, I need to check the distance between the player and the fake player in playermoveevent and if the distance getFrom(), say, is more than 30 and getTo() is less
send packets again?
what about the REMOVE_PLAYER packet, when should I send it?
Player#getViewDistance
and check by chunks
dunno, figure it out
does anyone has utility class that load json itemMeta to, ItemMeta object?
yes
Or is there any build in way to serialize json meta to object?
ye
us BukkitObjectOutputStream
either nms or api
I need this just for prototype
Can you instantiate an event manually?
sure you can
Yeah you can use BukkitObjectOutputStream to convert it to a byte[]
(And then possibly to base64)
does obviously not mean the created event will "happen"
creating a blockBreakEvent does not mean the block there will break
Is that SNBT? If so https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFactory.html#createItemStack(java.lang.String) (but you need to add the material too)
declaration: package: org.bukkit.inventory, interface: ItemFactory
isn't ItemMeta#getAsString already SNBT ?
yes
ah so coll is delusional as always
except without the material
yhx
Yeye ofc, it's just for tests
don't have such a method.
Ah
getClientViewDistance
Yea I guess you can Entity#getAsString
the player still does not have such a method in 1.12.2 spigot
1.12.2 
The best version with 0 exploits
Yep
I prefer 1.7.10 tho
It's still got that beast log4j exploit
it doesn't?
Do we need EntityFactory now :p
Ughhh I just wanna RCE on MFs computers 😳😳
yes and then a factory factory
Idk I heard it was patched at a launcher level but I don't use the vanilla launcher also for servers MD only patched back to 1.8
So it's still a valid concern pre 1.8
Coll1234567, is there a method to get the player's view distance in 1.12.2?
Reminds me, I wanted to look at some soft spoon code 
Cry
client side only?
Don't soft spoon PR up stream!!! Come onnnn you know yoh wannaaa
I'll give you candy bars!!!
fun side node, there was a guy yesterday asking why mojang hasn't bought us or spigot 
Bro forgot about bukkit 💀
I mean that one was bought
There is a reason we're not using bukkit right now
log4j was patched for pretty much all the versions via the launcher
most non-mojang launchers will use the mojang log config anyway
Pre 1.7.10 yipeeee
so good
Baseddd
You see I have this trusty webpage
molang
I need to become spigot staff so this gif is relevant
Maybe in the next thousand years
@eternal night Think ima rewrite bukkit this weekend for the fun of it gonna probably release it and make a trillion dollars tbh gonna suck to see spigot and paper die so fast but what can you do ig 
cmarco level of cope
Don't mention that name I want to forget that he's unbanned
was he banned ?
Yes
Well he's unbanned now but God if he realizes
oh xD
He was never notified of his unban
i hope nobody DMs him
lets keep it this way 
👌
Why eas he banned
I believe he had undiscord deleting messages every 60 seconds from his catalog of over 20,000 plus messages
Why
"Privacy"
reported for reporting to report
He was active on spigot today
is there a way of making a flying mob walk? my objective is to make a walking ghast that can melee attack
you'll have to deep dive into NMS
so i'll have to basically make a mob from the ground up
I mean tbh libs disguises could be a play
"It walks like a ghast, talks like a ghast, but in reality is a zombie in disguise"
what about the hitbox
True true
I work more on the skills side of it, but maybe mythic mobs already has a solution to it (disclaimer of bias, i work as a dev for it on Mythic Enchants, so grain of salt with this one haha)
yeah you just nuke all the objectives and make them walk
PathfinderGoalMeleeAttack
it's like 5 lines of nms
^
or like 20 if you do it the proper way
PathfinderGoalMeleeAttack needs a PathfinderMob as a parameter
yeah that's the nms ghast
for example I extend the nms creeper and register custom attack goals to not attack spectators on my minigame
:)
ghast isnt a subclass of pathfindermob as far as i know
p sure it is
that's uh
EntityInsentient in obfuscated nms
Monster extends PathfinderMob
hm interesting
yeah just make a custom melee goal then
you can try fucking around its moveControl
Do you guys use the maven javadoc plugin when making your own library
yes
then what about making it walk
inject the walk navigator and not the flying one
or like
override the travel method
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/util/Vector.html#checkFinite()
this only checks for each component whether it's abs is <= Double.MAX_VALUE
declaration: package: org.bukkit.util, class: Vector
always been a thing
p sure
I'm having so much fun changing my hardcoded strings into proper message keys rn
man I got completely sidetracked from my programming work looking at whether I wanted to buy an investment property
like 100% derailed me for a couple of days
also may I recommend not buying properties with a 25 year loan in the current housing market unless you like 2x the total to pay
it's an investment rental property, its value 1.5x in the last 1.5 years but taking into account the bank loan price I'd be paying 2.5x what it was worth 1.5 years ago
not worth it
it was a unique opportunity due to some very specific factors but it just doesn't make that much financial sense right now
but hey if they fail to sell for a year I'll show up and offer 66% of their asking price 
yo i have an object that has only final values, when i call new Object, is this even taking any significant processing power at all? (all the values are predefined)
if that's all it's doing, no, absolutely not
but if you really want to know scale it up and test it
yeah its basically just for sharing values and i didnt wanna use enums
use enums
use enums with initializers
what initializers?
constructor
it's definitely july though
ah yes make the poor intern do 366 if checks
if checks? This can clearly be done with string manipulation
paid by the hour
just mangle the data into a file name bro
you think they're that good?
oh true
magma keeps throwing shade at me being paid by the hour 
oh actually I have a fun story
there's a new intern at my local gym
he's studying fitness at uni
he does not know a single fucking thing about anything at the gym
not one muscle, not one exercise, not one machine
it's hilarious
let him cook
my personal trainer is training him (since yesterday) and at one point during my workout he points at a leg press and asks "what exercise is that for"
and the dude says arms
10/10
imagine doing uni studies when going to the gym a single time would've taught you more
also he was asked to come up with a training plan for I think it was legs and shoulders as an exercise
and he gave 2 leg exercises and 7 shoulder exercises for the workout
average jeans wearing enjoyer
funniest part is, if I understood correctly, he's never gone to a gym before
I actually know more about fitness than this dude and I actually went out of my way to pay people to figure this shit out for me because I don't have the time to learn it for myself
I feel like his parents must have expectations of him or something because why the fuck is he going to uni for FITNESS if he ain't know the first thing about it??
I probably know more about fitness than that MF and I go to the gym like once a month lol
I genuinely believe he went into the only field he had an average that would accept him or something
lol
fitness studies kinda infamously have very low required averages for entry
and this is definitely a low IQ andy, ngl
fitness is for those who don't know nun else
like
my cousin had to repeat the year 4x and he went to fitness type deal
I think fitness might be a field with a degree of complexity too high for this dude, he should go check if there are any openings for a position as a pedreiro
that might be more his speed
might have to teach him how to use a hammer first, though
oh and also how to draw patterns
this like a new config sys
nah
just me not using hardcoded strings for messages
messages.send(player, "no-permission") -> messages.send(player, MessageKeys.NO_PERMISSION)
it's literally a string wrapper
laughs in standardized configuration engine message initialization
you still need to tell what msg you want
I don't hardcode my msges
I hardcode my keys :)
I bet you don't even autogenerate and autofetch translatable strings
homie my utils are more advanced than you think
well to be fair that is not very hard, I think very little of you
🤡
I like stealing your entity packets though
that code's ass
I didn't bother making it nice
so I'm glad it meets your quality standards
it tells me how low they are
I like that I didn't have to look shit up, I changed the homework because I'm an A+ student and I wouldn't want to get caught hanging out with someone who is cousins with someone who failed to enter fitness studies 4x
ah, even better
dw I despise my family too
do they despise you too? Because I might be warming up to them right now
can't wait for you to come ask me for my client-sided world homework :)
🍿
meh I do wonder, there was a time where I drew a line in the sand saying that I would rather make my own game than write nms code
nms is easy
tbh I don't even think that was a bad line to draw, even now that I'm over that line
it's not about being easy or not it's about the hassle
kicker is that I did all this shit without using any tools or mappings
like why bother with that hassle
not to devalue the work of game devs but to be completely clear it is easier to make some games than to make some systems I've created
time to get $5 artery cloggers
half a chicken is like 3,5€
I was talking about the pizza numbnuts
oh
yeah it's open
I think their cheapest pizza is 4,5€
still bigger than pizza hut lmfao
talked to my nutritionist today
not to devalue the work of game devs but to be completely clear it is easier to make some games than to make some systems I've created
is gonna go into my quote book
seems like I'm not going to be losing weight
I've worked on prototypes, it is no small amount of work but making something like a vampire survivors clone or a basic platformer is genuinely not hard to do, and they sure are games
meanwhile I'm over here doing stupid shit to make a tower defense game in minecraft with custom models that supports several versions
I mean yea, I guess. Barely a fair comparison for a game like minecraft
I mean there's full on games made in mc, the tower defense game is pretty much self-contained
making it in minecraft is more work than making it standalone
Yea, I mean that is half of its selling point tho
Was the bundle finally added or is that still some preview thing?
yay
I believe the reason it was never released was because of mobile controls
idk if that's the official reason
true I heard something like dat too
but like seems plausable enough
I always knew you were half the man I am
bros got 128 or sumn
it shows 96 but it is 128
I was thinking of doing 96gb for the memes
but nah
I also got a mad deal on the 32gb kit
it was like 50 bucks
the newest imacs only go to 24gb, that's so weird
ddr1
meh I don't even think about it
I scarcely ever push my rig anyway, it's massive overkill for most things
I guess my IDE + browser use like 15gb by themselves
not using a gpu is just garbage
my pc reaches like 26gb ram when I'm at work :)
I do appreciate the extra ram for video editing
bro thinks he a ytber
I use 32gb normally for just having a lot of stuff open
but I should get into the habit of closing stuff
16gb is like the essentials
manage your pc well and you'll go far
32gb is if you're lazy
I'm actually about to do a lot of yt stuff
64gb is if you dont turn your pc off at night
soon I'll be rolling in that raid shadow legends money
I used to use a laptop with 4GB of RAM
same
It actually worked, but it was slow
I built my pc with 5$ plugin money I got off my dad's laptop
so I learned patience
my first pc was a shitty hp pavillion laptop, it ran cs:source at 4 fps
back in '98 or what
huff my shorts
dinosaur
zoomer
it's not even an old model, my first computer was a black and white monitor apple laptop
only got a pc much later on
I think my first pc build was literally just a bunch of parts my dad found on the side of the road
with a hdd he stole from work
and a sketchy 200w power supply
I kept wishing my family would let me get a pc instead of handing me down their old macs, the only games I could play were civilization and then runescape (though not consistently, my browser has issues)
I have a really nice and loving family and they keep telling me they're proud of me, they've got my back and I've got theirs
I worked to buy my shoes n clothes from the age of like 12
how are you making money through development please teach me the ways dude
uh
where the hell were you even living that this was the case
I'd live under their roof and ate my mom's food until like 8th grade
make plugin get paid ezpz
were you living in a korean webnovel story?
made a minigame network last week and blew all the money on an office chair
I'm not cultured so idk what that is
you didn't need to say that first part, we know
opensource = good for portfolio
guys
just learn how to manage
all of my projects are open source
i got like 3 million users on a project and not one dollar
how :(
it's called skills, I recommend you get good
actually correction currently my least popular project is closed source
it must be caged and hidden
it's just because I want to make it into a standalone game and I don't want someone to just yoink the logic and balance outright
Here's the spectrum
On the left side you have commission stuff
1:1 customs, you do it and move on
playergivehead
On the middle, you have public plugins
Maybe you charge for it, up to you
And on the right side you have open source
Left = +money, -popularity
Right = -money, +popularity
And middle is a weird one where you struggle with both
@tame sedge
you can make big money and have it be open source
ayo?
when
if it were easy it would be called your workout
oh okay
Anyways
This spectrum applies to your project, not your career
If all your projects are open source and you don't market it then yeah good luck making money
so me?
I didn't advertise
So you're in a middle
and it's all open source
If all your projects are commissions then you make cash fairly easy, but you struggle to grow an audience
to be clear there is a difference between making a plugin and making content
or there can be
just use BukkitAudiences to create audiences. problem solved
like right now I'm making a system that allows you to create your own custom models that cna be used as mounts in-game
but I can also sell premade mounts
and the system would still be open source
other people can do this as well
I don't even do minecraft dev tbh, I did it like once 6 years ago and make 15 bucks with this pretty simple custom bosses plugin
25$+ / hr take it or leave it
the thing i'm working on rn is just a bit of an undertaking for a solo dev so i thought i might try minecraft dev again for a day or two
¯_(ツ)_/¯
we are talking about developing plugins
we're talking ab career development
no
open a thread
it's help-development not help-zushee
channel may as well be help zushee now
go stuff your mouth with $5 pizza, you don't even disagree with my statement there
ngl this 4$ pizza is bussin
you're just hangry and craving cardboard
does PlayerMoveEvent even get fired in that case? shouldn't it be VehicleMoveEvent?
+1
hi I want to learn how to create a plugin can you tell me where to learn?
do you know java?
i have to learn it
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
This might leave them speechless
TIL baeldung is java specific
it isn't
ChatGPT wrote ?learnjava :p
its Actually really into Scala
you could teleport the player instead of the boat? it looks like you can't teleport occupied boat for some reason, if teleporting the player didn't work then you'll have to remove the player from the boat, teleport it as you wish then put him back, I'd just try teleporting the player first since it's better approach
??
Entity entity;
Vector vector = entity.getVelocity();
if (vector.isZero()){
// ??
}
then update your spigot to the latest one
What is the dependency version you are using?
just check the velocity yourself
Enjoy
it's just a vector
according to Single Resp principle
what LANServer and LANClient can do and what they shouldn't
One message removed from a suspended account.
One message removed from a suspended account.
I have a lot of UI and and some operations based only on TCP and UDP packets
LANServer should handle and manage connections and process request
LANClient should handle its connection and sending/receiving data
I'm thinking about creating some sort of Layer class, which can close the UI tab if tcp calls a ConnectionLostEvent, and also can stop packet sending/receiveng if user presses a UI button by sending some kind of PlayerClosedTabEvent
rn my server gets an instance of a UI tab inside the connection method so it can close the tab when something goes wrong
and code looks really messed up
One message removed from a suspended account.
is that a plugin
One message removed from a suspended account.
How do I loop through all existing entities (even entities that aren't loaded in any world)? Cause i'm trying to receive entitytypes from a configfile but I don't think you can save entities so I save strings and I need to be able to compare the string to the entity names
you also shouldnt compare strings with entity names ig
LivingEntitys are PersistentDataHolders so you can store PD tags on them instead of saving them to config
so they should never touch the UI part, right?
yes, that breaks SRP
is that a right approach
prob, if there is some functions in the UI that needs to do things with the connection then it could use another implementation that's responsible for that, do not implement anything in UI that it shouldn't be responsible to but use other implementations through interfaces if needed
Cancel connection while joining
input a password
close the "Joining. Please wait" panel if i get to a timeout
so ui affects connection and connection affects the ui ofc
Thanks I will try this, but I dont need to save specific entities with like a UID, just the type or is that what you meant. I just want to make tasks where you have to kill mobs and I want to save the amount and which mob in the config
so i thought about a layer class which directs events between UI and Server
well, you just loop through the loaded entities
and if entities of this type should be killed, server kills them
yes but the UI shouldn't have any implementation of anything connection related, it'd talk to interface that has implementation and responsible for connection related stuff, SRP basically talks about having 1 reason for that class to change and if you implement connection logic in the UI then you'll have another reason which is changing UI related stuff and connection related stuff, breaking SRP
Well, my UI has a button for example
so when i press it, something should happen like a ButtonPressEvent ig
are inner classes inherited as well?
only if explicity inherited
can i inherit both ? or is there still only 1 inheritance allowed?
if (AttackerName.contains("§5King of Spider's Servant")) {
new BukkitRunnable() {
@Override
public void run() {
Vector up = player.getVelocity().setY(0).setX(0).setZ(0);
player.setVelocity(up);
player.sendMessage("Debug3333");
}
}.runTaskLater(this, 20L * 1L);
}
``` any1 knows why this doesnt work?
What do you expect it to do
is the name actually correct
Because the vector is named up but it has all 3 values set to 0
should cancel kb
since its an onentitydaamgeentyty event
name is correct
debug msg isnt sending anymore
i orginally wanted it to push player up
but for testing purposes is et it to 0
to see if it would cancel kb
since i couldnt get push player up working
1 tick should be enough, rather than 20
Also if you are on latest there is a knockback event
sadly i am not
actully i might
i am not
but yea i do what this to be a damage event
as i want to send the player flying up when they get hit
i could update actully
maybe
🤔
You should identify the entity with pdc instead
whats pdc?






