#help-development
1 messages · Page 1472 of 1
ill try it
bruh what does discord do to my indentation
doesn't change it
hmm
i think that i could probs have some sort of garbage collector that goes behind a bit and instead of clearing them immediately just send an unload packet to the clients
what exactly are you trying to clear? The whole chunk?
yes, and impossible on spigot
No it isn't
How can you generate the chunk data for that specific chunk only?
yeyeye, but that would require a custom chunk data algorithm
Have you tried running your code on the ChunkPopulateEvent instead of the chunk load?
paper has a method:
Bukkit.createVanillaChunkData()
i think so
i will try again
yeah it does the same thing
Hi
hello
How can i set an items meta specific to a certain player
so like have say a players kills on their sword
but only their sword
and for other people it is different
Ummm, i mean you can give a player an itemStack with a specific meta.
Do you want to pick up some1 elses sword and see ur stats?
yes
Hmm
ok
but i dont want to create a different itemstack for every player
i want to use the same itemstack
so you would have to listen to them getting the sword and then change the meta
Store the data tied to the player and then set it to all items in that players inventory
you'd have to modify the lore when you pick it up
You could modify it in the outgoing packet technically
that sounds overly complicated
i have data stored but how can i modify the items meta without affecting other players itemstack
What?
basically
Honestly I would call it simpler, but /shrug
When the player picks up an item
yes?
Clear the custom data from it, and then set it again with the new owner
yeah, fair enough
but wouldnt that change other players sword
Why would it do that?
like this sword
No, only the item you pick up
say i had this
and when a player got this sword
they have a custom meta specific to them
static?
Thats not how it works
so each items itemstack is different?
mhm
as soon as you give it to a player it is a different itemstack afaik
oh that makes it much more simple
thanks
so i can jsut access it and change it
sorry for taking tiem cos im dumb
np
is there a better way to do this
List<String> allBlockStrings = new ArrayList<>();
for (Material block : allBlocks) {
allBlockStrings.add(block.toString());
}
I mean, what are you trying to do
converting every item in a list to a different type
can i do that with streams or something?
im not sure
yeah lvj
you could Idk if the allBlocks iterable is big
then a parallell stream might suit you
allBlocks.stream().parallel().map(String::valueOf).collect(Collectors.toList())
hello, why armor stand isn't small? i tried spawn EntityArmorStand via packets
WorldServer s = ((CraftWorld)owner.getLocation().getWorld()).getHandle();
EntityArmorStand armorStand = new EntityArmorStand(EntityTypes.ARMOR_STAND, s);
armorStand.setLocation(owner.getLocation().getX(), owner.getLocation().getY(), owner.getLocation().getZ(), 0, 0);
armorStand.setSmall(true);
PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(armorStand);
((CraftPlayer) owner).getHandle().playerConnection.sendPacket(packet);```is this good method?
Heyo, I made a custom entity with NMS (custom silverfish), at the moment it walks on the ground, can I specify another Y?
Hi, someone can give me a plugin for add things to vip, change de name, etc
hows the thing that runs whenever a player clicks something in chat?
like "next page" in chat
and it does something or whatever
wait nvm
Clickable Components that run commands
Like GroupManager or PermissionsEx?
that handles permissions
yes
Use Luckperms
more like SUCK perms
is it possible to create an anvil inventory?
like without an anvil?
i'm trying to do something like this
Inventory ai = Bukkit.createInventory(null, InventoryType.ANVIL, "Map Name");
ai.setItem(0, new ItemStack(Material.MAP));
((Player) sender).openInventory(ai);
but I want ai to be of type AnvilInventory
cast it?
you should be able to create an anvil inventory
there is only 3 inventories that method can't be used to create
It might not work but I'm not sure https://stackoverflow.com/questions/58805978/creating-and-setting-itemstacks-in-an-anvil-inventory-bukkit-spigot-api
Read above gecko
what is the name of the event for when you place a block
How can i set EntityArmorStand as player's passanger? I tried with player.setPassenger() but this method requires Entity (not EntityArmorStand) and i tried with armorstnad.startRiding() but it requires Entity too (not Player), sow how can i make it?
they both extend Entity
and i tried casting but it didn't help, i was getting errors
yup 😄
https://github.com/WesJD/AnvilGUI Since the inventoryCreator doesn't create it as an AnvilInventory but uses a default converter, you can't cast it.
for EntityArmorStand you need to use the bukkit wrapper if you're using the bukkit method on the bukkit player
CraftArmorStand is what it's called probably
which implements bukkit's ArmorStand
and wraps over nms' EntityArmorStand
I am trying to add a delay to my code. I would like it to wait 2 seconds and set the event to be cancelled. How would i do this?
then can i delay it to set the block to air or null?
delay what?
so bucket use?
Hi, someone have a antiXray?
you could cancel the event, then start a runnable with a 40 tick delay to spawn teh water block and replace teh players bucket with an empty one
you don;t delay you use teh Scheduler to run a task later
oh
oh you want to replace teh water that was placed.
thats easier, you don;t cancel the event, you just start a runnable
new BukkitRunnable() {
@Override
public void run() {
// code
}
}.runTaskLater(plugin, delay);```
all you have to do is a final Location where teh water was placed in your event
and in your runnable loc.getBlock().setType(Material.AIR)
probably be safer to check the block is water before you set to AIR
If this is your main class, yes
oh no
Bukkit.getPlugin(YourMainClass.class)
or use Dependency Injection and pass the instance
private JavaPlugin plugin;
public YourListenerClass(JavaPlugin plugin) {
this.plugin = plugin;
}```
im a bit confused lol
@eternal oxide So i just need to put the name of my main class?
no
bc my main class is MultiPractice and it errors when i put that
Learn dependency injection. I gave you all the code you need
I have an example of DI btw lol
https://gist.github.com/Conclure/a01d187ab9127149a919daec6547757f
Might as well inject DataManager as well
hi, if i buy 1 premium plugin ... can i download it as many times as i want? or is it only 1 time? What happens if the plugin is updated? Can I download it again?
help me pls?
arguably no
The entrypoint is usually responsive for bootstrapping the plugin thus making it the context provider of all loaded resources isnt a bad idea. If we want to extend (not extend as inheritance) the event listener at a later point then it will become easier to just pass our context object rather than individual dependencies at a later point of time. Of course we can talk about modularity and component embracing but scalability and extendability is important needless to say.
But yes if I would use a DI framework like Guice then I would probably do that instead.
So the entire point of Dependency Injection is that you let the upper level control what is given, or Inverse of Control. If you still go through the Main class to get dependencies, you force your main class to contain a certain shape, the getDataManager(). That kills the entire point of the modularity provided by a DI design. There's no difference in Bukkit.getPlugin(YourPlugin.class) and your public MyListener(YourPlugin plugin). The client (your listener class) isn't supposed to know where DataManager comes from, it just cares that it gets provided.
Indeed a very good point. However let's say that this is the case. Such that MyListener only depends on DataManager. Then just passing the DataManager instance through constructor might be sufficient enough. But now lets say you also need to depend on a StorageProvider, a Configuration and a TranslationManager. One way we could handle this is to of course pass all of the four dependencies through MyListener's constructor like MyListener(DataManager, StorageProvider, Configuration, TranslationManager) and that take some time to rewrite from just MyListener(DataManager). Instead what we could do is to use our PluginMainClass as a context object and then pass that single instance instead MyListener(PluginMainClass). Then expose our dependencies through accessible methods in PluginMainClass like PluginMainClass#storageProvider(), PluginMainClass#dataManager() etc. By doing this we can easily add new dependencies without having to reshape our constructor of MyListener class. Of course we would still let upper level control whats given as we could pass a different instance of PluginMainClass which might provide a different implementation of DataManager and what not. Bukkit.getPlugin(YourPlugin.class) is not a thing, did you mean JavaPlugin.getPlugin(YourPlugin.class)? But yeah arguably it may be beneficial to just pass DataManager in the first place if we can ensure that it is going to be the only dependency.
Yes even if you need 10 dependencies you just need to put them in the constructor
Because the design is to not force the provider to require a certain shape
Why should we use a builder
It is hard to maintain constructors which have many arguments.
Can even be recognized as a code smell iirc.
It can be a sign of bad design, but if you really need the dependencies and there is nothing to be improved then that's it
We just have a 10 argument constructor
From experience you don't really use that many though
First and foremost long constructors are hard to maintain. Then Idk what you mean with require a certain shape.
Of course its tightly coupled to what PluginMainClass#dataManager would provide
The certain shape is that you force your provider to have functions like getDataManager()
Tightly coupling isn't good always but making your application cohesive in terms of coupling it with certain shapes isn't bad needless to say. Let's say you have multiple components all depending on DataManager through constructor. It can be very tedious to swap implementation. But if we would use PluginMainClass as a context provider then we would just have to swap the implementation of #dataManager(). Which might be beneficial if you need cohesion.
That's where the provider comes in
It's also why Java gets memed on a lot because you just build layers upon layers with these designs
Also one thing you forget if you need to swap is to work with interfaces
?
If you only use the interface you don't need to mess inside the classes
You only need to do stuff at the toplayer
What are you on about now moving from DI to abstraction?
I mean sure interfaces a good to create high level abstractions or what's your point?
So if you design it like this
public interface DataManager {
boolean save(Player player, Data data);
}```
```java
public class SimpleDataManager implements DataManager {
public boolean save(Player player, Data data) {
//the stuff here
}
}
And then in your listeners it would be like
public class MyListener implements Listener {
private DataManager dataManager;
public MyListener(DataManager dataManager) {
this.dataManager = dataManager;
}
//The rest here
}
So if you are swapping your DataManager with another DataManager, you only need to do stuff in the upper level
public class MyPlugin extends JavaPlugin {
private DataManager dataManager;
public void onEnable() {
//Just change this line.
this.dataManager = new SimpleDataManager();
this.dataManager = new NoSQLDataManager():
//So you don't have to change these
getServer().getPluginManager().registerEvents(new MyListener(dataManager), this);
}
}
Because you are using abstraction
Yes but we are not always using abstraction, you should only create powerful abstraction which uses the power of polymorphism. Else you would use a normal class.
Then we can also just alter DataManager class right
There would be no need to change all these lines
I mean, pushing most functionality behind an abstraction is probably a clever idea if you are planning on serious production code
They got a very powerful usage though
Ehhh, idk about that xD Like, an interface just for the sake of interfacing might still be useless for unit tests
Especially for testing as you can easily mock services
🙂
useful you meant lol?
lol yeah fine, but I would still argue for that it should be used when you can take full advantage of polymorphism (can never spell that). A con I experienced when using many interfaces is that it got quite hard to navigate through my application.
And yes that might be a clever design in some scenarios. But I would still say that you might want to tightly couple it to what your plugin provides assuming you want to create strong cohesion there instead of totally loosely couple it.
Im gonna go sleep now gn 🙂
This is basically only useful if you work with a group or on enterprise level
otherwise its a huge overkill
if another person asks about getting the title of a custom inventory, im gonna punch my monitor
what are we arguing about
people getting their custom inventories via inventory view name
no argument
just right vs wrong
i'm seeing several walls of text regarding abstracting and polymorphism
dependency injection design
injecting shit is for junkies
How can I get the time for a specific country?
Date date = new Date();```
LocalTime iirc
Is there any difference between !Files.exists(f) and Files.notExists(f)
Apparantly the state of a file can be "unknown"
From javadoc Note that this method is not the complement of the exists method. Where it is not possible to determine if a file exists or not then both methods return false. As with the exists method, the result of this method is immediately outdated. If this method indicates the file does exist then there is no guarantee that a subsequence attempt to create the file will succeed. Care should be taken when using this method in security sensitive applications.
ic
I am spawning an armour stand with the below code:
armorStand = owner.getLocation().getWorld().spawn(owner.getLocation().add(-1.5, 0, 1.5), ArmorStand.class);
armorStand.setBasePlate(false);
armorStand.setArms(true);
armorStand.setInvulnerable(true);
armorStand.setCanPickupItems(false);
armorStand.setSmall(true);
armorStand.setCustomName(followerUser.getDisplayName());
armorStand.setCustomNameVisible(followerUser.isDisplayNameEnabled());```
For some people it displays correctly however for others it appears as a default armorstand with the armor on.
I have tried using a bukkit runnable to rerun the attribute settings 5 ticks later to try see if that fixes but it doesn't seem to.
If the player unrenders the entity and then renders it again it fixes. Is there a way in which I can force this reload for the particular entity for players to fix this? OR is there an alternative fix that any of you know of?
have you tried isolating the plugin
sounds like something is interfering with packets
Yeah I have it did the same without any other plugins
All clients are 1.16 and so is the server. I can somewhat understand with the version difference why there might be errors haha. I'm wondering if there is a way in which i can almost force rerender the armour stand for players
Yeah I knew there would be a way with packets but unsure what that way is
Very good question, that's 2am code for you
I wrote the majority of this a while ago but have only recently been bothered to investigate further into this bug
That doesn't sound particularly fun haha
Wondering if there is a way I could teleport the armour stand away and then back
Or something like that?
Would be an iffy method but could work
is there a way I can store simple data (a string) in an entity? my entities do not have their own classes and I need a way of differentiating them
Persistent Data Containers
There are some good Spigot threads on them if you give it a Google
alright
another problem I am having is understanding the distinction between some classes
for entities it seems like there are separate inheritance chains and I don't know why this is or how to work between them
Sorry I don't quite understand what you mean
as an example I sometimes have to convert between worlds and craftworlds and there are two different ItemStack classes that I can convert between
Ohh I've not gone deep enough into entities to know I'm afraid sorry
Hopefully someone else will know
CraftEntities extend their Entity counterparts
so all the different versions of them do so
who loves 🅱️lackspigot :)
how do I get the row and column from a slot in a chest inventory?
why would u need that?
row = slot / 9 and col = slot % 9, all parameters must in integer
just use the slot number???
also row and col starts from 0
i never actually know what modular (%) does
lol
That's what google is for m8
I’m using a GUI api that needs rows and columns and doesn’t use slots
but it's faster
make ur own
But is there a better way
hey so i'm using mohist as the base .jar file for my minecraft server so i can run mods and plugins so i can set up a shopmenu system but i can't get the coding for bossshoppro to work can someone help me get the codings to work for that plugin? or at most set up the coding for my servers shops i already have the codes basicly made but i need help getting them to work properly and yes the plugin works like this i know of another server then mine that is doing it but they aren't willing to help me much so if someone could point me in the correct direction i'd appreciate it
You'll have to ask in mohist's discord/forum whatever, this isn't really the best place to ask that sorta thing
i'm asking for help on coding the plugin Bossshoppro i already have everything else situated
mohist's code is most likely different than spigot's hence my message
ok
how does one convert a string to get the uuid of a player, for example, arg[0] could be a string, but I want to get the UUID if the name is a player
UUID#fromString
that doesn't do string > uuid though does it i.e. Sam > 24352345-8cf0-11sd...
If you wanna go name -> UUID, you'll have to get the player then get the player's UUID
@vagrant stratus am I doing it a terrible way or?
you can do Bukkit#getPlayer, it'll return null if the player doesn't exist though
so do a null check
is there a getOfflinePlayer(String) that's not deprecated
u can still use it but u probs should use uuid instead of getting by the name
normally deprecated isnt things that u cant use its just that deprecated things are normally old or just not recommended
doesnt mean u cant use it tho
but u dont have to use it
I get a argument which is a string, I need to convert to a player, then to a UUID, so having the offline just helps to ensure the user is both a playing or have played user
@vagrant stratus better?
Should be fine now 👍
I don't understand xD I'm quite new to java and bukkit
thus, still playing about
rip your nitro lol
you are
lol
discord doesnt tell people if they have nitro classic or nitro it just says they purchased some nitro
is there a way to get all users that have played the server
so that I don't get only online players
hey guys, I'm trying to make a plugin to detect how many zombies were killed by the player before spawning a creeper (as a "boss"). What's the best way to keep track of zombies killed within a game instance?
well if u want it to stay after the plugin gets restarted best way is to store it in a file or on a database i think
nah no need
just need it for that specific instance. it can be stored in memory
just use a variable?
lol I understand, but I'm new to spigot/bukkit api. Not sure what to store in that variable
its not spigot/bukkit its java
u should really learn java
just increment one to that variable when the zombie is killed
theres a ondeath event which i think works with zombies but u gotta check if its a zombie
declaration: package: org.bukkit.event.entity, class: EntityDeathEvent
actually i think its thisjava @EventHandler public void onKill(EntityDeathEvent event) { Player killer = event.getEntity().getKiller(); if (event.getEntity().getType() == EntityType.ZOMBIE) { // code here } }
u also gotta register the event tho
and also u gotta implement listener
@granite stirrup that was actually very helpful. Got it working thanks!
np 👍
If the server restarts and you need to still have the data i would recommend using a database
i want to drop all of a player's inventory's content onto the ground, is my method fine, or is there something wrong with it
if (deathDrops) {
PlayerInventory playerInventory = plr.getInventory();
for (int j = 0; j <= 36; j++) {
plr.getWorld().dropItemNaturally(plr.getLocation(),playerInventory.getItem(j));
}
}
(also i have no idea why its spaced out that much)
its spaced out that much cuz u copied it from ur src code where it had indents before but now u copied it still has the indents so all u gotta do is remove the indents
when u paste it
then it should be fixed
if (deathDrops) {
PlayerInventory playerInventory = plr.getInventory();
for (int j = 0; j <= 36; j++) {
plr.getWorld().dropItemNaturally(plr.getLocation(), Objects.requireNonNull(playerInventory.getItem(j)));
}
}
but also depends on how much that loop is runned it might make the main thread kill itself
what should i do then
can't you just loop thru inventory contents
i think so
inventory getcontents something blah blah
also be aware that an inventory slot can be null or air
yeah bukkit is weird
like that
its either null or air
and the javadocs are wrong a lot of the time
to be specific either null or Material.AIR i think
ye, intellij just warned me about that
e.g getEquipment methods say not null when it can in fact return null...
XD
u could just try catch it
that's bad
not good design for that
and i mean its kinda a overcomplicated if stament
XD
someone used it as a if stament
ngl
i saw it
on a Video
cuz they were using java without if staments
and other stuff
like for loops and while loops
oh no
try catch isnt bad lmao
i mean u dont need to use it much
but sometimes its helpful
when something throws something its so fucking gay to add the throws exception to where ever method im using it in
I mean sometimes you have to use it, for stuff like PreparedStatement
for (ItemStack item : player.getInventory().getContents()) {
if (item == null || item.getType() == Material.AIR) continue;
// drop item
}```
i just dont like adding the one line throws exception cuz then u gotta do it everywhere it uses it
imagine calling a method from something that uses a throws exception in the method and theres like 50 methods behind that before it gets called including the main one its gonna be a pain
so i like using try catch instead
i once saw a plugin that would throw a UserIsRetardedException if you tried to double click the jar file
private void playerInfoMethod(Player player, String arg1) {
Player playerName = plugin.getServer().getPlayer(arg1);
if (!(playerName == null)) {
UUID playerID = playerName.getUniqueId();
String queryName = playerID.toString();
...
} else {
player.sendMessage("Invalid user!")
}
```Is there a way to get all users that have been on the server? As currently it only grabs those who are online
Bukkit.getOfflinePlayers
better idea: file ransomware in the main class
public void isGay(Player player) {
throws PlayerIsGayException(player);
}```
i dont think thats how exceptions work
Asking to get banned :p
its the main class
oh no
if you use the plugin as intended, no problem
Still in the jar code 🤷♂️
Would still get deleted
notatrojan.exe
not if they dont find out
If it does anything malicious, it's gonna get deleted and the author banned 🙂
imagine someone posted something named Virus and it wasnt a virus
run your mc server with full admin privileges 🧠
I check the code, so that's not an issue for me 🤣
have it backdoor ur server*
that would also get a resource deleted & the author banned
yes we get it you're responsible
apparently this is a backdoor https://www.spigotmc.org/resources/savagegenbuckets-1-8-1-13-the-ultimate-genbucket-plugin.63051/
proof?
Reviews?
There's no reports
wasn't EWG basically ransomware if it thought you were using a leaked jar?
thats what i heard from somewhere
how to i throw errors
um i proof from 🅱️lackspigot
That's not any real proof, leaked versions are modifed
nah on the b l a ck spigot page for savagegenbuckets it says NOTE : USE AT YOUR OWN RISK : The plugin contains a backdoor DIRECTLY from the spigot version, and it may not be safe to use on your server. We are leaking it here because he is literally charging money for a backdoor on spigot lmao
hey optic, when will open source plugins be mandatory
I'll look through it 👍
Bug md_5 about this
md
XD
the only bad thing about b lackSPIGOT
is that
u have to sign in
to download stuff
and why is that bad
adblocker?
and that it's illegal
maybe
as for the supposed backdoor, not finding anything yet
it's probably something that gives the owner all of the plugin permissions
a lot of plugins seem to do that
lmao
i just want to make sure that its not a backdoor XD even tho im not gonna use it since it costs money
and i cant afford a cent
and it's not open source 😕
nope
u cant sell something for money and also make it open source
u pay for the support
many people have
and those are the people that wouldnt buy it anyway
i mean citizens cost money and u can get it for free from them
and would use a leak site
because you pay for le support
Base code has nothing malicious 🤷♂️
wait when was citizens 2 open source https://github.com/CitizensDev/Citizens2
always
go fix mc performance
i cant not a good coder..
mc servers run on basically one thread tho XD
not so much anymore
well yeah but it used to be
and with things like paper chunk loading is async 😄
yeah but the normal mc server i think is still one thread
with 1000 players:
the thread!
https://tenor.com/view/fire-flames-burning-on-fire-gif-17475635
depends on your server type tbh, survival has all those machines
i think they should have like 2 threads for like half the players each
or something
1 thread for chunk loading and then the main thread for everything else
so 4 threads
might be able to get u more players
technically allowed, has a default value though which i assume is theirs
nice
no
after 100 it's 📉
i think the developer for mrbeast's events even said that
not if you can modify the server itself
u probs can get on like 150-200 but it be very laggy and might crash
yeah, but if you want a good playable experience i think it would be max 100
if ur on 1.12.2 tho u could easily run 200
100 is easily achievable for our server type
like, we can ignore most of the vanilla bs of hoppers etc
well ik
1.8 is bad
but i like 1.12.2 also 1.8 is old
look at big hcf servers
we modified server code to readd old knockback and stuff instead
1.13 tho is probs the version u shouldnt go below
but 1.12 is nice
normally people run 1.16.5 servers
1.16 is more stable than 1.13 imo
lmao
but 1.12 is before they moved to string ids
so i like that version
1.13+ is just bad
and performance is shit
well yeah in some places in 1.13+ theree are using ids but most of its string now
k gtg
bye
The performance in 1.13+ isn’t bad at all
I enjoy how there's endless conversations every day about which server version is the most efficient and then you see timings from actual users where one heads database plugin or one random russian shop plugin is using 1000% of the tick for whatever reason
^
weird question but what is the fastest fading white particle in the game?
I'm trying to come up with a fairly specific effect but am having a hard time
Just test every particle (;
how do i lower regeneration rate
i want to keep it peaceful difficulty
but regen is ridiculously fast
Cancel 50% of regens or something
Mess around with EntityRegainHealthEvent
damage the player on a delay
why does Thread.sleep() not work in a command?
Use the scheduler to schedule a delayed task
read up on BukkitRunnable
there's a #runTaskLater
why do I always mess up rotation math
how can i get the Plugin?
...
you might want to take a step back and go read the guides that cover the basics
no Main.getPlugin() ik but what do i have to write in the ()?
bro shut up...
you write something that is not helpful, and does not bring me a step foreward so shut up
Because you shouldn't be going a step forward
just this or what
without learning java
go learn java is not only useful but also the only thing you can do right now
^
the plugin is this
good lord
well rotation matrices tend to use radian anyhow, as do the ones in the API
I am tempted to just covert degrees though
Main.getPlugin(Main.class)
ohhhh okay iam dump
No worries
why is my water bottle packaged like an apple product
man they must be spending half of the cost of the bottle just in packaging lol
's a good bottle, feels good man
🥲
mine has been a life of suffering and of really bad water bottles
I'm happy to get a good one
and your water bottle now thinks "why do i always get the baaaaaaad guys"
how can i cancel the InventoryCloseEvent
you can't, you can only reopen it
still too stubborn to take anyones advice?
The best you can achieve is to get the Top inventory on close, then in a delayed runnable force the player to open it.
HA good luck figuring that out without basic java knowledge 😉
hm I just pulled a calculator out to figure out 24*2
this is going to be a long day
48
yes
cutting back on caffeine sucks
in java you can just write 24*2 it calculates it for you
OMG FOR REAL
yes, thank you skull, I am aware
You'll be the one crying when you figure out not learning java yet trying to learn spigot wont get you anywhere
I'll be crying when I see the performance impact of running these many rotation vectors per tick
don't look forward to having to cache them
Then why do it?
because I need stuff to rotate?
rotating entities
oh
is getViewers a new getTitle?
what in the english
?
Viewers has nothing to do with title
getTitle
clearly, that's not how you spell losing
it will
learning java by doing spigot is totally fine
maybe not the best way but totally fine and always possible
he cant just do spigot lmao
ik
true
there is "always" java
or you are using some third party things like visual bukkit or stuff
yes
👋
and iam very happy with what iam doing and you can not say anything else
send the code
please read the definition of dump
xd
not you at all
lol
he said to me iam dump
he said you r dumb
Dumpling
this whole discussion is giving me flashbacks of arguments I've had with angry russians
yes
concluuuuuuuuuuuuure
Shrimp dumplings?
in csgo on surf servers
Shrimp shredded dumplings
.
xD
Ya'll making me hungry
why learn java when you can hop on a chatroom and get it to make a plugin for you line by line?
okay conclure.. its early morning.. we are not alcoholics
😑
spoonfeed costs for now
$1 per line
$0.5 per tip
let's hope that's not retroactively true because then I'll be owing quite a bit of cash lol
Even better deal $0.50 per line and ill call you degrading names for free
oh my lord there is nothing more annoying than testing something really random
okay guys
do the god damned power, dragon
$1 skull
idk min jung
well I have a japanese class now, peace
Hello! How to set player current openned inventory title?
You can only change the name of a currently opened inventory with packets
Can you show me or let me go where to get example of it?
Just copy the inv and make a new one xD
I don't know how to do it
with diff title
But here I want to change living inventory title
There are no usable code and article for it now
public static void updateTitle(Player p, String title) {
EntityPlayer ep = ((CraftPlayer) p).getHandle();
PacketPlayOutOpenWindow packet = new PacketPlayOutOpenWindow(ep.activeContainer.windowId, "minecraft:chest", new ChatMessage(title), p.getOpenInventory().getTopInventory().getSize());
ep.playerConnection.sendPacket(packet);
ep.updateInventory(ep.activeContainer);
}
This code error parameters of new PocketPlayOutOpenWindow()
I got this from your link
Actually I already search it, but I still can't get it. Can you give me an example of code?
Yes, you can't just copy/paste as that code is for 1.8
you have to update it for 1.16
it is also using CraftBukkit so its version dependant and you have to use Spigot not Spigot-api
why don't you just reopen the inventory with your wish-title?
Wow, ready! Finally I can do it! Thank you ElgarL
Because I want a next level, reopen look like a glitch
Hey I have a question:
How can I create a book in Spigot where something has already been written (e.g. hello) and which only opens the first time you join?
PlayerJoinevent
ok and how can i write something in the book?
the BookMeta interface has the respective methods needed to fill the book
ok thank you very much
Check Player.hasPlayedBefore
ok i try thank you
I'm back regarding this issue if anyone could take a look that'd be awesome
try to use the consumer based spawning (which should set these values before the entity is even rendered/sent to clients)
declaration: package: org.bukkit, interface: World
how can i check for ever if a player is over an specific hight?
oh i think this is a book that will be put in inventory
can you also open a book page without adding a book to your inventory?
I don't think that is possible in newer versions of the game
tho there is a helper method for the player
I think Player#openBook
i use 1.16.5
Yeah try Player#openBook
I'll take a look at this thank you
then I would have to create a book variable beforehand where the meta and such is stored. how can you describe the pages there?
check the BookMeta documentation for it
declaration: package: org.bukkit.inventory.meta, interface: BookMeta
more specifically https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/BookMeta.html#addPage(java.lang.String...)
declaration: package: org.bukkit.inventory.meta, interface: BookMeta
You need to create a new book, set the metadata (pages) n shit
^^
it has to be a written book too
Someone know how can i add 1.8 support to a 1.12.2 plugin?
Material.WRITTEN_BOOK
Or link me something
Bruh
Unless you're using NMS, it should be fine
what're you trying to do?
if you're trying to port a 1.12.2 plugin => 1.8 good luck lol
I use intellij and paper 1.12.2
if it compiles, https://tryitands.ee
or want to support 1.8 :>
Heyo, I made a custom entity with NMS (custom silverfish), at the moment it walks on the ground, can I specify another Y?
I use it :kekw:
Dont make fun of me
🔫
I like the combat mode of 1.8 than 1.16 so my servers run on them.. So I use 1.8 api
lmao
I don't quite understand it right now. Can you send me your line of code from it?
i
there
player can be in two different scoreboard ?
i wanna let all player see team color above their head and a unique score board on the screen per team
pretty sure that is a no
but you can simply create the teams on all the individual scoreboards
what do you mean ?
thank you
I mean, you create a new scoreboard for each player/team to setup the individual sidebar display
i'm actually doing this right
just apply the teams with their respective colour to all of those scoreboards
but players need to be inside the same scoreboard to see other team color
what ?
lets say you have the "red" team
and scoreboards for team red, blue and green
now all of those scoreboards have individual sidbars yes ?
but isn't that also an item that is put in the inventory?
ok
don't add it to the inv
like they do
just use Player#openBook
so zelytra, you now have three scoreboards
and on all of those
you register the teams red, green and blue
as the first page then opens directly
on all of them you add all the players to their respective team
and then add the red players to the red teams scoreboard
haaaaaa i see this is "fake team" inside each scoreboard to only show color isn't it ?
okay ^^ i see thx
Lynx?
yes ?
The book page opens directly. You don't have to click on the item beforehand or something?
yes
ok thank you xd
Anyone know why this is happening? I set the 4th argument suggestion to <amount> but it showing up this instead. (The suggestion before argument 4 is shown exactly like what is on the code)
Heyo, I made a custom entity with NMS (custom silverfish), at the moment it walks on the ground, can I specify another Y?
I want my plugin has 1.8 support to 1.12.2 (i started by 1.12.2)
I want support to 1.11 1.10 1.9 and 1.8
^^
is it args[3] = <amount>
I do it like that
nvm
What?
You mean libraries?
Uh, What is the problem
You mean imports?? Just delete the line lmao
Oh like that
I think you search the file name
How can you store item enchantments in a text file? Then load these enchantments.
Configuration
config.yml
In a separate file. I don't understand how I can synchronize them by name, and then add them by name.
I mean can you be more specific, like what do you actually want? When are you going to read/write to the file?
Why is InventoryView::getCursor() return ItemStack instead of int of slot? And InventoryView::setCursor(ItemStack itemStack), why not to put slot in parameter? If so, then how to set player cursor in a specific location in GUI?
you don't
the cursor is pretty much client side
the cursor item returnd is the item the player is currently holding "out of the inventory"
as if you picked it up but didn't put it in your inventory yet
yes args[3] or args.length = 4
PROTECTION_FIRE 1,PROTECTION_FIRE 2,THORNS 1, ...
I am translating so many lines.
And I write to the file.
lol
I use nms, there are a lot of plugins that starts from 1.13/1.12 and have 1.8 support
Your point?
xd
basic idea is that you hide all your NMS implementation logic behind interface abstractions
and then dynamically select the correct implementation for those interfaces based on the server version that is running
It doesn't matter what the format is. I don’t understand how I can get the name of the enchantment in order to translate it!
noob idea is that you rely on reflection
but even that doesn't work
just because it is reflection doesn't mean variable names don't change
also, there is https://papermc.io/javadocs/paper/1.16/org/bukkit/enchantments/Enchantment.html#getByKey(org.bukkit.NamespacedKey) and https://papermc.io/javadocs/paper/1.16/org/bukkit/enchantments/Enchantment.html#getKey() respectively @late dove
declaration: package: org.bukkit.enchantments, class: Enchantment
one returns you the key of an enchantment and the other allows you to map the key to the enchantment
Thing is you can entirely skip interface abstractions if you really want to and just use some nasty switch thing with nms
If you prefer switch statements over each version to an interface abstraction you should not be using an object oriented programming language
No Problem
That is true however it’s for some reason very common in these nms compatible plugins I recognized
mostly because a lot of plugins are pretty meh xD
Yeah
Hmm have you tried Guice or Daggar? If you tried both which one is best in your opinion?
I am not the biggest fan of DI Frameworks but dagger 2 specifically is the one I use if I have to
Hmm okay then I will try that one this time
make sure to grab the intellij plugin for it xD
Oh nice didn’t know that existed
🥲
why does this cause
Air has no meta
what
the yellow background
it is already telling you (if you hover over it)
that this might cause a nullpointer exception
so will this owrk?
use ItemStack#isSimiliar instead
you probably wanna null check and return or something like:
ItemStack item = event.getItem();
if (item == null) {
return;
}
doesnt my if statement include it onw
now
Yeah
Don’t forget item.getType.isAir
why
Because air has no meta
now?
oh god, don't do that on the if statements please
yeah but then item would already be null
why?
that's too long, make your code less readable
wait what
Air is not null
anyone know a free hosting site which allows me to add custom plugins?
localhost
127.0.0.1
its what i do now
whats that?
jebaited
i mean i didnt open it
or you can always try 192.168.1.1
huh
I don't know if there's any good free hosts.
now this doesnt cause errors but doesnt work either
Free == shit specs == shit server == shit experience
Spigot is inconsistent with air and null
I believe the interact event will return air
I don't doubt that
TBH I only check items that I want to check, I don't check for items I don't want to check
anyone have an idea of what's the fastest fading white particl
I can't get this effect down
Is there a way for one command (/fly) for example to trigger essentials and my own plugin?
Or are they always unique
you can listen to the command event itself
I think if you register it yourself it'll either overwrite essential's or the other way around
why not write your own fly command
Yeah it does I'm looking to make something like socialspy so an listener would be the way to go i think
you meant command?
you can intercept it on PlayerCommandPreprocessEvent
or, unregister previously existing command, but that would need some reflection
Yeah, I was stupid i made An CommandExecutor but that only overrides it ofc..
yeah thats not the way to do it IG
I'm gonna look into this thanks alot 😄
declaration: package: org.bukkit.event.player, class: PlayerCommandPreprocessEvent
*Some examples of valid uses for this event are:
Logging executed commands to a separate file*
Well there you go
That sounds exactly what i need haha
how do i stop thst
check if it's air you psychopath
the thing is
oh shit I just found a really cool and innovative way of giving players seizures
What is it magmaguy
hundreds of FLASH particles moving around
i do
you getting an error or smth @oak mica
;-; wut is problem den
wait i do
it doesnt tp player
is there any errors in console
^
what's at line 49
if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
thats not 49
Cannot invoke "org.bukkit.inventory.ItemStack.getItemMeta()" because "item" is null
yeahhh
I expected better from you Amoghus Coding
sus
I don't know what flash particles are
well I've seen them and I still don't really know what they're used for
I could probably tell you if I knew what they looked like
