#help-development
1 messages · Page 2111 of 1
🤨
Im getting this Cannot invoke "org.bukkit.block.BlockFace.getOppositeFace()" because "this.mainFace" is null exception when constructing a new BlockIterator but Im not able to identify exactly when its going to be thrown
at org.bukkit.util.BlockIterator.<init>(BlockIterator.java:139) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
yes i know but isn't working
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
i mean
the code what i do is working
but when i type one % in the chat
it breaks the format
bruh
thats normal
cancel the event
just replace it
i expect it to properly instantiate a new BlockIterator object but its not, it sometimes happens it sometimes doesn't
and send message to everyone
bukkit.broadcastMessage?
or something like this
why
package samplepluginspigot.samplepluginspigot;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public final class SamplePluginSpigot extends JavaPlugin {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if(args[0].equalsIgnoreCase("hello")){
player.sendMessage("Hello There");
}
}
return false;
}
}
I made this plugin which just sends a message to the player when they do /hello and i wondering if i did it correctly? ( Btw there are no errors )
because it will get all recipients
and?
but ijust can send the message as server
now it would be /hello hello
it would no be good
why
the string array starts after the main command
the command must be in plugin.yml
wait what?
i think it is because of mojang filters
command.getName()
Oh k
they have a chst filter now
use that
thanks for the help
then remove the arg check unless you want it to trigger on /hello hello
like this then?
if(command.getName().equalsIgnoreCase("hello")){
player.sendMessage("Hello There");
}
```would this be correct?
just
yep
👍 thank you for telling me abt it
dont matters
as long you cancel it
Hello, what packet is sent when player does riptide boost in water? I can't seem to find in Protocollib client's packet type category. I know (from what I found on google?) it's sent out to other players as entity metadata, there is a byte field Is in riptide spin attack, but how does server know when player tries trident boost from water? There isn't much on google about this. What I want is to cancel that packet, basically change boost behaviour.
👍
there is one that is called when he stops pulling some items like arrow
when i get home i will let you know
ohh, well that makes sense, I will try to research
yes
i think i sent it here a time ago
try to search here
yes
.
@upper mica
1.17
how can i get the block that the player is seeing?
with player.getEyeLocation().getBlock() ?
How to spawn a MushroomCow?
MushroomCow cow = (MushroomCow) loc.getWorld().spawnEntity(loc, EntityType.MUSHROOM_COW); <- Error Line
cow.setCustomName("§7§oAlfred");
cow.setCustomNameVisible(true);
Error:
java.lang.IllegalArgumentException: Location or entity class cannot be null
Yeah but none of them is clear
I mean EntityType.MUSHROOM_COW is definitely not null
@manic delta
location isn't null given that you call getWorld
You can just put %s first time is display name, second time is message
try calling spawn(loc, MushroomCow.class)
Okay
It will automatically be parsed, no need for the other 2 arguments
you can use rayTrace
o
okay i will try
or multiple the location with the getDirection for 3 times
wait
getTargetBlock
better
LivingEntoty#getTargetBlock
Wizard ho do you told me to calculate if moving, to right left, etc?
or something like this
I couldnt catch the altgorihm
@hybrid spoke
- PlayerMoveEvent
- get facing block
- difference between to and from
Algoritm:
- if player facing north and the block is west = pressed a
But then im stuck with the nexts
it have a set parameter
let me see
i need to use chatColor to modify it or it already have?
you can just rotate the entire speed and eye level
Girgleb
damn man has battery on his phone
you can use null
Hmnin what way rotate?
same error
velocity is multiplied by sin,cos(yaw)
getTargetBlockExact is better @manic delta
so you do some funky stuff to remove the yaw from the equation, then do your checks
ok
then use the int for the max distance
👍
Allright but how which be the algorithm for calculating left, right, button, et?
the velocities are going to be in a single axis
tbh you can probably just
velocity.rotateAroundY(-yaw)
+Z should be north
Oh im really dumb lmao
Yes you'll need to color it
okay
ImIlussion allright what about for top and bottom?
just use the Y level for that
Can i dm you i want to talk something personal?
uh ok whatev
I think that "%s" can only be used when doing:
String.format("text here with var %s", "var content")
No that’s a placeholder api thing
lol
yes i know but i dont know how to implement there
String format uses similar syntax
go to PAPI github for guide
Wait what are you trying to do
i mean
Lol
What do you think that code is doing
Replacing the color of %s (That should be the player name) to &7 color and add the vault prefix before
event.setFormat needs two %s
The first one is the name, the second is the message
yes i will try later im doing something more now
look at the implementation
wym
assuming this is asuncplayerchat event
Yeah
just decompile it and see how the format works
yes, it gets called, but setCancelled(true) does not take any effect, boost still happens, although all calculations are handled server-side (I have decompiled the jar and checked)
discord just froze lol
lmao
messages came in all at once
public class VillagerInfectEvent implements Listener {
@EventHandler
public void onInfected(EntityDamageByEntityEvent ed){
Entity e = ed.getEntity();
if(e instanceof Villager){
Villager vill = (Villager)e;
if(vill.isDead() &&ed.getDamager() instanceof Zombie){
vill.zombify();
}
}
}
}
hm this doesnt work
(trying to convert into zombie villager on any difficulty btw)
Villager is not going to be dead on the entity damage event ever
Yeah
adding onto this, you could either use the scheduler to check on the next tick, or check take the damage value off the entities health and zombify it if its >= 0.0
Definitely would not do next tick
scheduler to the next tick is dumb
Use the damage value
health - event.getFinalDamage() <= 0
Nah
zombify spawns a new entity
^
for that then
cancel the PlayerInteractEvent
That didn't work, as the event is called when I'm starting to boost
yes thats the idea
you cancel the event
but
the client still will send the packet
If I take a list from a config and make modifications to it, will it change the list in the config? (I mean the config that is in the jar and not saved yet to the server)
obv. not since you would have to update it
Hi I was trying to get a string using a method that comes from main ie getSpawnConfig
so in the event class I used main.getSpawnConfig.getstring ("test"); to set a join message but gives an error when the player enters the server I think it's the fault of the custom file .yml
?paste the error
what is the error
uh I don't really get it, the event is being cancelled at that moment when I start boost, so it does not take any effect when I release after some time
I have an API interface in the api package, should I add the implementation there too?
io.github.quzacks:
api:
IPlayerDataRegistry
core_kits:
packages:
OtherThings
CoreKits
So it would be
io.github.quzacks:
api:
IPlayerDataRegistry
PlayerDataRegistry
Well if you do that why would you need the interface anyways
The whole point of using Interfaces like that is to hide the implementations
it does
Some guy told me it's better since it makes the implementation more "robust", just went with it
make sure you are cancling PlayerInteractEvent and not the packet
can you send the code of those lines
ok
oh, well, it still boosts me
show your code
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(new Listener() {
@EventHandler
public void onInteract(PlayerInteractEvent event) {
if (event.getPlayer().getName().equals("ItsTauTvyDas") && event.getPlayer().getInventory().getItemInMainHand().getType() == Material.TRIDENT) {
event.getPlayer().sendMessage("Interaction cancelled.");
event.setCancelled(true);
}
}
}, this);
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.HIGHEST, PacketType.Play.Client.BLOCK_DIG) {
@Override
public void onPacketReceiving(PacketEvent event) {
Player player = event.getPlayer();
Object handle = event.getPacket().getHandle();
if (!player.getName().equals("ItsTauTvyDas"))
return;
if (!(handle instanceof PacketPlayInBlockDig))
return;
PacketPlayInBlockDig.EnumPlayerDigType type = ((PacketPlayInBlockDig) handle).d();
if (type != PacketPlayInBlockDig.EnumPlayerDigType.f)
return;
if (player.getInventory().getItemInMainHand().getType() != Material.TRIDENT)
return;
player.sendMessage(event.getPacketType().name());
event.setCancelled(true);
//boostPlayer(player);
}
});
}
you don't need that nms check for protocollib
you can use the wrapped packet
sure the checks may be handled server-side but the client still does predictions
i dont think you want to do that in your onenable
such predictions may be items floating up, blocks being broken/placed for 1 tick
try to set the priority to normal
For some reason my project in intelij is corrupted. It can't find the libraries, the src folder and the resource folder isn't set anymore. I looked at my project file and it is nearly empty.
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
oh well I kinda thought of that too
well that sucks
still same
Hey, I'm trying to set the players health on respawn but I cant seem get it working. Using player.setHealth(double) on both PlayerRespawnEvent and EntitySpawnEvent both seem to do nothing. Is there something that I'm missing, or is it just not possible without some sort of delay with a runnable
What can I do about it?
Wait for 2 ticks I believe
do not delay it !!!
XD
Why
this happens every time
i would reccomend tracing your steps back and see what you did
no thing
because then you don’t have the proper stats for however many ticks it takes
i updated my intelij
fixing things by delaying it a bit should only be done for something not essential to gameplay

It's definitely fine to delay by a tick.
Especially since there's basically no other option there.
someone help me?
…
it is not
i have found many dupes on many different servers just because they wait just a tick or few to do something
your quit string is likely null
i guess the message not being set
i know but this isn't the problem..
I'm fairly certain setting their health a single tick after they respawn is not going to introduce a dupe lol
Then what do you propose they do ?
what is the easiest way to do something like this:
do something
wait x seconds
do something
wait x seconds
do something
wait x seconds
do something
wait x seconds
do something
wait x seconds
do something
?scheduling
it really depends what you’re trying to do, in general it’s never a good idea to just take the easy way out and delay something by a few ticks because that can cause a lot of unseen problems
people don’t seem to understand how many things you can do in one tick
plugin.getConfig work main.getSpawnConfig doesn't work
I never said that's a solution for everything, and I'm aware that it can cause issues. For them specifically though, there's absolutely nothing wrong with it. If you have another way to solve their issue, do explain.
Your concern is not unwarrented, but I do not think there is a "propper" way of doing what OP asked for.
Then why not use the simplest ?
let’s say i log off the tick i respawn, the task is delayed by 1 tick and tries to set the health of a non existant player. then i log back on and still have the same amount of health, which can probably unbalance the entire game
but how can i do multiple waits and multiple actions after eachother
Add an event for plaer logging on
And for the issue of the player not being connected, check if the player is null
adding random event listeners for things that shouldn’t be a problem in the first place… not to mention trying to set the health would probably cause an exception and mess up anything else that was trying to take place
If this is so problematic I really would like to hear your other solution that doesn't cause any of this.
i don’t have a solution off the top of my head lmao, probably something somewhere to set the default health when someone spawns. the point is it can cause a lot of problems and end up with a lot of spaghetti patches, such as the example i’ve given
We should probably stop this discussion and come to the concenses that people have different ways of solving issues.
In addition sheduling always needs careful consideration of possible sideeffects.
That was never something put into question
uh the client only sends out dig type of f field, which printed to me as RELEASE_USE_ITEM
you can do it however you want, just don’t say i didn’t warn you when someone with a client logs on and breaks the entire game system
._.
https://imgur.com/2o8qJj3.png I'm configuring a plugin and I'd like to know if I can add a tag that only adds the effect if all the armor is equiped
itemtag:effects_list_full_set: SLOW,1,true,true
something like that
Or add the effects
For example if I want haste 4 do that the helmet gives you haste 1, the chestplate 2, leggings 3...
Hi! I know it’s not possible for listening to keys other than F. But does the client send something to the server whenever you press some keys on your keyboard?
Just for knowledge
nah unless they changed smthn
wondering if this is a jdk or just eclipse?
I'm going to make an API for a plugin, it's a kit PVP plugin and I just want to create it so that it returns a PlayerData class. I don't care about hiding the implementation since it'll be a private plugin so how do you think I should structure it?
hi i wonder how do i make so my plugin do a command in console
Bukkit.dispatchCommand
I have a question concerning Vault and mabe someone could help ?
I am not very familiar with Vault and am trying to setup a system where I can get the balance of something that isn't an OfflinePlayer, but rather a town/faction/group or similar.
How would one do so ?
I tried using an ID for the group, but the Economy#getBalance(String) is deprecated.
The only "right" thing there is is Economy#getBalance(OfflinePlayer), but I don't have one...
So maybe someone could give some advice, a nudge in the right direction.
Would be greatly appreciated, thanks :D
I tried just using a UUID for it and put it into Bukkit#getOfflinePlayer(UUID), but then lateron it gives me a NullPointerException, since the economy plugin (or Vault) cannot get the name from the "fictional" OfflinePlayer.
maybe create a custom OfflinePlayer implementation with just a getName(), getUniqueId() and whatever else it needs
call it like VirtualGroupPlayer or something
I want to create a folder inside the data folder of my plugin to store data. So plugins/plugin-name/file-name/ If I wanted to do that would I do this?
file = new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "players", player.getUniqueId().toString() + ".yml");
I considered it, but I thaught I'd ask here before I implement that.
Would have done it and as it seems I will do so, just wanted to see what others, maybe with more experience than me, would come up with
Anyways, thanks for the reply, I'll try it out
due to the way vault is (appereantly) implemented, i think this is the only way
Would getAbsolutePath for the data folder return plugins/plugin-name ?
you can just put the datafolder in there instead of the name
and then player + file separator + uuid .yml
ye
hey, i m trying to add an API to my project but it doesnt seem to be working.
this is the ghithub : https://github.com/Janmm14/JsonMessageMaker
my code (in pom.xml)
i added :
<dependency>
<groupId>de.janmm14</groupId>
<artifactId>jsonmessagemaker</artifactId>
<version>3.2.2</version>
<scope>provided</scope>
</dependency>
and
<repository>
<id>janmm14-public</id>
<url>https://repo.janmm14.de/artifactory/public/</url>
</repository>
i also checked, the version is the right one :
did you try mvn reload?
file = new File(plugin.getDataFolder() + File.separator + "players", player.getUniqueId().toString() + ".yml");
```?
new File(plugin.getdatafolder, "player" + file.separator + uuid.toString + ".yml")
ayo wtf i did it like 10 times and i was getting the same error , and now i do it again and it workd wtf
thx anyway
the first argument is the parent file
a folder is considered being a file too in java
No, I want it to be in the players/ folder inside plugin-name
Nevermind, just had a brain fart
I spawn custom mobs and then I just leave the world and come back some time later and the path finder goals seem to be resetted
it's not working
can't help with "it's not working", without the code or error
How would you go about making a player fly in a boat?
what more then Bukkit.dis... is it like ("helloe");?
Java docs
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), “command without the slash”);
There’s no reason it shouldn’t work . Either you don’t call that part of the code or the command doesn’t exist
hey so i have this code :
if (command.getName().equalsIgnoreCase("gang")) {
if (Objects.equals(args[0], "invite")){
if (getjobs(playerSender) == Job.PARRAIN) {
Player argumentOne = Bukkit.getPlayer(args[1]);
assert argumentOne != null;
TextComponent message = new TextComponent("Would you like to join ?");
}else{
onError(playerSender);
}
}
}
but when i run it, i have this error :
TextComponent(java.lang.String) is not public in java.awt.TextComponent; cannot be accessed from outside package
Wrong import?
please
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
if that will compile it wont work without errors
check the length of the args and use String#equals instead of causing an out of bounds exception
handle cases where the player is not found too
ofc i check if its a plyer, if its right etc
https://paste.md-5.net/yapozacaxa.cs pls help
lol what
What's up with it
Ohh I see
npr for the quit string probs
What's on line 20 in Eventi
how is java supposed to know what main points to?
it uses its artificial intelligence neural network of course
it just knows
I don't know how to program well yet but I created the getSpawnConfig in the main and reported it on the event class does not give any error on intelj
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
my g just said he don't know english
One second
what language does he know then
my mom
ok
i am calling the main class it can be done in these ways right?
Italy
you need to pass the main instance into the eventi class
something like
public Eventi(Main main){
this.main = main;
}
ok I try and let you know
ok
the problem is that main is null
the word "main" remains red ...
and youre basically having your plugin instance twice bcs of those two fields
could you solve the problem so that I can see the code please (sorry for the inconvenience)
?
:P
Amin
Amen
Main class named main smh
thanks
well read it and it kinda makes sense
I'm not very good I'm trying to learn ...
had to learn not to have two plugins with main classes called "Main" the hard way
Aha
i don't understand sorry
It's okay, nothing important
As long as your other plugins don't follow this practice no issues should occur
of course you shouldn't call your main class "Main" you dumdum
you need to index them
so Main0, Main1, Main2, Main3
and remember that utility classes are negatively indexed so Main-1, Main-2, Main-3
also remember to name your methods by picking 5 pi digits sequentially in the class
'Eventi(me.dragon.rcjoin.Main)' in 'me.dragon.rcjoin.Eventi' cannot be applied to '()' onother error
surely you mean main.main.main.Main0
Tf
Not sure if this is the right server for bungee plugin development however I was wondering, how do I get the ip of a connecting player from the net.md_5.bungee.api.connection.PendingConnection class
do new Eventi(this)
fun fact my plugin celebrates 5 years today
how time flies when you're creating and then fixing bugs
how time flies when you're making quests
because??
can't tell if you're referencing the fact the plugin now does indeed have quests or if it's something unrelated
cuz you need to provide the right number of arguments it expects
yes
ah understandable have a nice day
ty u 2
making low poly unity games is quite fun
really cute when stuff starts to visually come together
Is it a problem to have tons of scheduleSyncDelayedTasks ?
like 100 at once?
depends on what they re doing
removing a block after a second
I literally have thousands of them up at a time sometimes
probably not
alright
like if some giga5brain plugin decides to start requesting every head skin ever from mojang
i hate my life
"plugin" don't work https://paste.md-5.net/woqotuxibo.nginx
at me.dragon.rcjoin.Eventi.onJoin(Eventi.java:26) ~[?:?]
have you tried making the tutorial plugins from the spigot wiki
What's on line 26
Is there a function to visually see the chunk you're on?
String firstjoin = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("FirstJoin.Message")).replaceAll("%player%", p.getName());
then I suggest you maybe take a step back and go learn the fundamentals of java better because if you can't figure out what a null pointer exception is you will be spending 8 hours a day asking why every line of your plugin is erroring
Can you show your config file?
doesn't f3 have that data?
you are right
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Yes, but I want to mark the chunk with particles or a block without needing that
don't do particles or you are probably in for a bad time
unless you go extremely sparse odds are you will lag a client out trying to render the required volume of particles
with the old code it worked https://paste.md-5.net/wihanejove.makefile
And how could I indicate the chunk that the user has protected?
What worked? Wasn't there an error with your old code?
the best way I've seen this done was by faking world borders I believe, where the client gets the sorta barrier but not really visual client-side but I am almost certain that requires a lot of packet trickery
Paste your full code right now
From main and eventi
at least I think that's how they did it, I never looked into it myself
yes with the old code work
ok
then use old code?
in the old code it didn't let me use plugin.getSpawnConfig
i found a very good site
but the rest was fine
this is just creating a cargo cult approach to making a plugin
I hate that website
what
???
You forgot this
Is there any way to deplooy jar to multiple folders using sftp? (intellij deploy tool). Currently I deploy my jar to one folder.
Sei italiano?
si
Bella
Ahah
come faccio a vedere se un player ha 2 permessi ? tipo if (p.hasPermission("prova") || ("prova1")){}
?
Devi fare if p.hasPermission(“uno”) || p.hasPermission(“due”){}
ok grazie
👍🏻
Is there anyway to instantiate all classes that extend a base class
I don’t think so. You can either put all of that information inside an Hashmap or a List or either I think reflection can help, but in that case I can’t help you
Voglio fare tipo che se un player ha il permesso join.owner il messaggio di join cambia se un player ha il permesso join.utente allora il messaggio sarà un altro, pero se un player ha l'op avra tutti e due i permessi quindi si sminchia tutto ci sarebbe un metodo ?
Ah alright
Se ha l’op puoi verificarlo con il permesso *
gia ho fatto una bozza ma c'è sto problema
quindi if(p.hasPermission("*")) va bene?
Maven is not properly shading all the dependencies, I don't know why it does this. It used to work fine before
<groupId>io.github.quzacks</groupId>
<artifactId>CoreKits</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
</dependencies>
?paste
Si
Maven is not properly shading all the dependencies, I don't know why it does this. It used to work fine before
Sorry I’m not really good at Maven… so instead of probably saying something wrong I let someone else help you
you have not setup Lombok correctly https://stackoverflow.com/questions/42257379/how-to-configure-lombok-with-maven-compiler-plugin#50058828
Set<Class<? extends BaseItem>> classes = reflections.getSubTypesOf(BaseItem.class);
try {
for (Class<? extends BaseItem> clazz : classes) {
clazz.getConstructor().newInstance();
}
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
e.printStackTrace();
getServer().getPluginManager().disablePlugin(this);
}```
the exception is
java.lang.IllegalArgumentException: wrong number of arguments
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]```
I dunno anything about reflection tbh
I mean it tells you what the issue is
You need to give it the arguments of the constructor
Yeah but the constructor does not have any arguments
You sure
public BaseItem() {
System.out.println("Hey?");
}
very much so
Try getDeclaredConstructor()
Do any of you know if/when Mojang will require java 18 for Minecraft?
That works! thanks
well
it's the same for all version
pathfindergoals
just look at any nms mob class like EntityZombie
and how it uses multiple pathfinder goals
and make your own
then you can use reflections to access its pathfinder goals, or extend the class entirely for more control
@hollow sand
Can sb tell me what is PluginInstance
your plugin
I get this
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
@last temple i like you
straight to the point
we wouldve had the same answer
i didnt mean it like that but ok
..
when I try to do the super(EntityTypes.some entity). It won't let me pick any entity
or mob
eh
I am trying to make blocks that disappear and have a yml config file. In the file I store the block that disappears, and how long until it disappears. I want to create an item stack with these values (The time until it disappears is in the lore). How do I do this? I have a get, setup, reload, and save method for the yml in a class called customConfig. (P.S. I started Java 72hrs Ago.)
man's timing his java career
do you want one item stack for every block, or one for all
Only one block
might be different since I am using 1.8.8
Chosen at a time
then just decompile a sample entity and copy its contents
literally what I did
choose a block, create an item stack, make the lore, set the lore on the ItemMeta using itemMeta.setLore(List<String>) gotten from itemStack.getItemMeta() and then set the item meta back using itemStack.setItemMeta(meta)
then do whatever you want with that item stack
h o w ?
Sorry, I'm a slow learner
How do I turn the yml choice, a string, in to a Material object.
since Material is an enum, use Material.valueOf()
or nevermind use Material.getMaterial()
What will be better way to catch plugin messages on proxy (from spigot) and spigot (from proxy) and handle it? Make one plugin message listener and use switch case block, or make separated listener for each one subchannel?
grab some inspiration and make a packet system
Here Is it value of worked best.
reverse-engineering is a huge skill
legit just middle-click an NMS entity class and look at the constructor
NMS entity classes follow the following naming scheme: Entity<mobtype>
EntityZombie, EntitySkeleton
EntityBlaze
just look at the constructor and replicate it
Why not messages?
make packets through messages
you're transmitting binary data
a huge if / case block will be a ugly solution
also bungee messaging is kinda bad as it uses the client's socket to communicate instance<->proxy
and if there are no players online, the instance can't receive messages
Still get errors
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
because getPlugin() requires a string
"guys i think my plugins broken"
what the fuck is happening
¯_(ツ)_/¯
on my game?
yep it has translocated into non-existance
Hi! is the playSound method creating the sound for everyone near the player's location or is it like a packet, so the sound will only play to the specified player?
its called big explosion
And if it is the first could you help me with the packets?
depends which one u use
player.playSound is packet
and i think theres a world.playSound
no it has translocated into non-existance
yeah i meant this
so it is packet based
ty
ok
should i make that an actual thign
yes totally
in the lore of the Item:
Legend has it It once translocated a mouaintan in to non-existance
no
If I had an ItemStack with 1 Item in it, can I have a command give multiple of that item?
Hm?
translocated a hole
@zenith saddle
Totally put it in the lore.
ItemStack item = player.getInventory().getItemInMainHand();
if (item.getType().isItem()) {
// vvvvvvvvvvvvvvvvvvvv or something else
item.setAmount(item.getMaxStackSize());
}
mine is full of crops
??? i dont think no is an answer
anyways can someone help me fix the funnies
"or something else"
all i did was yeet a ton of falling blocks
tx
np
it stays after relogging, so its serverside smh
tf did you do
i had one that looked very similar before the world reset
not a sky world tho
mine is superflat
i made huge voidi
lmao
also this is epic
did it crash?
lmfoao
is it possible to create a true false dialog field when requesting a connection to the server but before actually transfering map data(joining)?
i get this every time i load my server
for some reason
some corrupted item stack or smth
similar to the download resource pack prompt?
a simple true false dialog would suffice with custom text(for legal compiliance reasons)
and ofc close the connection if declined
question is if the bukkit api and vanilla client support such
but that requires already being loaded into the world
i wanna put it on hold til the eula is agreed on
hm
What are you even trying?
what ive said
forcing players to agree/disagree the servers eula and gdpr compiliance agreement
before interacting with other server components
that ive said before^
and why do you need them to not be loaded in the world?
just put them in a box or smth
thats not exactly the point of EU law saying u must not store data of users unless they agree to it
governments give little fk about a bedrock box if player data is still stored
i already do that
im so extremely confused
but blocking the user from interacting with the env takes up alot of resources
esp blocking player movement events
mhm
Is it possible to make getter of spigot server name using bungee messaging channels ("GetServer")? Idk how can I handle it :/
this i do but ive also written a system around it blocking any other interaction as well as deleting all data upon leaving the server if they havent agreed yet. problem isnt the functionality but the performance
Minecraft doesnt really store personal data tho does it?
Even if it does, it doesnt give it to servers
first off
the client only gives away its ip, uuid
it links the uuid to the users ip address
so uuid becomes personal data
2nd
govt not giving a flying about us not re-distributing data
how tf does uuid become personal data? yk what im not questioning it
your uuid is public to everyone...
your ip is given to every server you connect you...
literally everything you connect to
yes but the server links the uuid to the ip address by storing that data in protocoll files
and as such u can trace someones geolocation by uuid
Can you have an int in a .yml file?
yes
neither UUID nor IP, combined or separate are personal data. an IP can be anyone
okay, so... if you're really worried about this just dont until they agree
hi
a: 5
so disabling the vanilla logger?
ah right
the vanilla logger that stores ip address and uuid in the same file an ip address that can be traced down to the streets name?
what happens if you get a string when you do .getInt(path);
dude your ip address can be trackeed no matter what stop being so paranoid
I think it returns as the default value
not sure tho
your ip is being tracked!!!!
im from Merica brother
then stop mocking me
just dont store passwords in plain text, then you're fine
i do
I'm UK and I run websites, so yes I know all about data protection. IP is not in it
silence continues...
cannot drop air lol kinda funny
How can I make getter of spigot server name using bungee messaging channels? Idk how can I handle it from the listener :/
its just cringe that ppl tell me "ur wrong blabla". its my property at risk if i violate laws not theirs so honestly, idk what to say to someone telling me im an idiot for trying to abide by the law in good faith
and this happens all too often
ive asked a simple question and get bashed for something else xD
No one said you dont respect the law, you have to assume others dont.
your not an idiot if you abide by the law.
ik
You assume others dont.
The IP a server recieves is not personal information
You can't link it to a specific individual
If you have a car and dont lock it then your dumb for assuming others wont take it.
And it's required for the server to function it is literally just a way of connecting your device to another one using the internet
im trying to say this in a respectful way, if you believe u cant be traced by ip address then idk what to say
when a player joins the server, you want the proxy to send the server id to the instance
then you can do whatever with that server id
Oh no! How shall I live with someone knowing my general location
You can't link my IP to me, sure you'll know my general location but it's not my personal information
thank you!
ehh not exactly reset
but ok
there's communication with DNS to indicate a change of IP
do you need a value for catch and what is finally?
finally will run whenever there was an exception or not
Catch catches exceptions
finally will run regardless, even after return statements
basically equivalent for java try { // some operation final_stuff(); } catch (exception e) { final_stuff(); }
But I think the GDPR says its personal information and I can't say anything to that
so you need to know what exeption?
just try {} catch {} finally { final_stuff() }
you can just do catch(Exception e) then that will catch all types of exceptions
or you would do catch (IlegalArgumentException e) to catch that specific one
depends on how you want
so uve finally came to the same conclusion. it is irellevant what you and i think, as the gdpr says it is personal data exactly
xD
which gets us back to the beginning
tx
Imma look at minecrafts policy there should probably be something that deals with that
it says microsoft isnt responsible for 3rd party servers
idk where gl diving
or was it about micro transaction sections i gotta check it too
Laws are usless, and uhh thats why firewalls exist.
bullshit is
that the gdpr forbids us from collecting data by default
but the data preservation law forces us to collect all data regardless
to be able to assist authorities
with uncovering crimes
But still you shouldnt have to worry about it
can this topic move into a thread or #general thanks
nah i think its done at this point ive also gotta go sleep xD
is it bad if it takes about 7 seconds per tick
Yes.
yay
its perfect
OOPS
I only see perfection
question still stands if i can fake a download resource pack prompt tho to get the agreement done prior to joining the server or not
which someone said no to
already done
theres not even anything spawned
How do i give dyed leather armor?
just use some random website builder bs that deals with that for you
Cause meta.setColor isn't a thing
they should comply with it
Cast the meta to LeatherArmorMeta
which then requires its own gdpr agreement xD kinda paradox
does someone have example code for a /give command?
yeah but they jave to deal wiht it for you
give up
task manager
Computers have taken over
of?
it works for me
well ur fricked
yay
wdym
(sorry for a stupid question but what do you mean by cast meta to leather armor meta? I know leather armor meta is a thing now but i'm not sure i understand)
(LeatherArmorMeta) item.getItemMeta()
if u wanna give an item to a player u just do player.getInventory().addItem(itemstack)
literally, cast it
Ah ok
stick.setItemMeta(meta);
iirc addItem also checks if theres a free itemslot
but make sure the item is a leather armor
Yeah
Uh, cast the 2nd argument as a material
like for a command deeling with arguments and targets
and add that item
cast the argument as a material
aka Material.valueOf
so not literally cast but like
u have to write ur own argument parser and honestly arguments are way too specific to use templates imo
you get it
ok but the player?
or just... Material.valueOf
he means a args parser
Hello, I'm tryna get setup on Eclipse, and I cannot get this working ... oh great just found out a dev help channel doesn't have image perms so you can upload a screenshot of the error
like when comes player
fantastic
verify
Bukkit.getOnlinePlayer(args[1]).getInventory().addItem(new ItemStack(Material.valueOf(args[0], 1)))
There
just ignore error safety
also i just realized that wont work lmfao
I added it to the libraries
okay so i see fromRGB(int rgb) and i'm wondering. can i do something like25510255 all as 1 int for that?
but why would you want that?
which would be white
So i can just do it all in 1 int so i can be lazy for now
rather than the base 10 format
since u can only add items to inventories of players who are online...
use online players
Player p = Bukkit.getPlayer(args[urIndex]);
p.getInventory().addItem(...);
``` @zenith saddle
How do I get started with spigot cuz the tutorial didn't work
if yall obv won't look at the screenshot
just hold my hand
Cant you just use a string thats separated by a comma or smth like "255, 255, 255"
and use split
Honestly, I'd start by trying IntelliJ, cause most of us use IntelliJ
No cause that's a string not an int
and so you'll be provided much better assistance with that one
I don't have time to install a bunch of stuff I gotta go work in less than 20 minutes
Integer.parseInt()
Oh
that wont work
how big do you think intellij is?
70gbs?
Why not?
cause its not a valid integer
Exactly!
255 is not a valid integer?
"255, 255, 255"
aaaaaand this is already wasting time just trying to get help cyall
Yeah, as I said, split()
This method takes a packed rgb int
Because, 255255255 looks a lot more confusing than 255, 255, 255
^^
That's fine
I do not care about readability for that right now as i just want to get some base setup that i can easily change later
Now I run in to a problem from a question earlier, my Item stack has 1 in it and I want to be able give multiple, how would I do that?
but imo rgb is just easier for most users
change the 1
Wdm use hex? I have to parse that into RGB then
What are you looking for
Are you looking for a solution to the problem using the spigot api?
fromRGB takes an int value as the rgb representation alr
Or are you open to using another library that would help you do this much more easily?
Because I have a command library that will make it easier
Bukkit.getOnlinePlayer(args[1]).getInventory().addItem(new ItemStack(Material.valueOf(args[0], 1)))
I honestly dunno if this works
just getPlayer
hello sergei
hmm, maybe we should do some checks before blindly doing all that
and then you in principle need to catch the possible exception Material::valueOf throws
yeah you definitely should
pffffffff who needs safety
hello Redempt
hence libraries
When you can just... ignor eit
which do all the safety for you behind the scenes
its not that hard to make it safe tho just gotta add like 2-3 checks
or just you know....
inventory space
plugins.yml
permissions
what is permishen?
you could also
how to add
plss help
give player:target material:type int<1,>:amount?(1) {
hook give
}```
which takes all the things Red mentioned into consideration
@CommandHook("give")
public void give(CommandSender sender, Player target, Material type, int amount) {
target.getInventory().addItem(new ItemStack(type, amount));
}```
I have an Item stack pre defined in an item manager class, It is an Item stack of one(changeable). Command: /block <Player> <amount>.
This will do literally all the checks required
It will automatically convert the types
You don't have to check argument counts
It supports optional arguments and will fill in default values if they are supplied
jeez okay red you can sell your product
It won't allow negative values because of the <1,> on the amount
ah yes Math.min(1,)
If you want to do all that stuff yourself then you can and it can be a valuable learning experience
and if i put 65
I have an Item stack pre defined in an item manager class, It is an Item stack of one(changeable). Command: /block <Player> <amount>.
it will give 1 stack and 1 item
But if you want to do it more easily this is one way
i guess
Well that implementation won't
You'd have to write the code to break it up into stacks as needed for that
how to make fly plugeni, i want to get flie on ssever and backdor
ok, I will just use a for loop and do it x times.
while (amount > 0) {
int stackSize = Math.min(type.getMaxStacKSize(), amount);
amount -= stackSize;
target.getInventory().addItem(new ItemStack(type, stackSize));
}```
Something like this would work for that
leetcod??
???
fly like bread?
this is certainly a compelling troll...
anyone have a resource on custom inventory texturing for spigot I tried some research, but couldn't find anything solid from what I see the best approach to this is a Unicode character, but I'd need an example I'm not too familiar with resource packs
Hi i was testing the api, and when i press A or D its correct, but then if i press W or S its wrong
- Custom vector class - https://paste.md-5.net/kejudawote.java
- Listener class - https://paste.md-5.net/ucucapawuv.java
In fact im doing something wrong because the letters are correct on some facings
I would be greathfull if someone can take a look
Likely just have another server running already in the background
terminal is closed