#help-development
1 messages · Page 1635 of 1
?
wants gravel as a block
didn't change into Falling block
how I remember this method don't work
lemme test rq
Do you want to prevent falling blocks from naturally falling?
yes he does
yea
but no as entity (as block)
wants the block placed by the player to have no physics
should still update it
that's a thought, but it breaks plugins like worldguard and log block
also worldguard doesnt have a flag for physics i just saw
and water flow disabling doesnt work with worldguard
Or just listen to BlockPhysicsEvent ...
Yeah true
and sends the packet to the player to destroy and re-place the block
don't work
oo yeah yapperyaps suggestion is probably the goto
What doesn't work about it?
blocks keep falling
I can share you screen
blocks fall when you place them (but they don't fall when you destroy the block next to them)
you could add {NoGravity:1} to the nbt of the falling block
keeps it as a falling block
ahh didnt see this
What path is this meant to be?
For
Maven > Executable file
it says value of 'maven.executable.preferMavenWrapper'.
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent e) {
if(e.getSourceBlock().getType() == Material.SAND)
e.setCancelled(true);
} // This event isn't needed
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
if(e.getEntityType() == EntityType.FALLING_BLOCK) {
if(e.getTo() == Material.AIR && e.getBlock().getType() == Material.SAND) {
e.setCancelled(true);
e.getBlock().getState().update(false, false);
}
}
}
```https://www.spigotmc.org/threads/prevent-sand-from-falling-upon-placing-sand.133386/
I was trying to use BlockToFromEvent but apparently falling blocks count as an entity changing the block.
yea I know this
but on one tick block does not exist and send to player useless packets about set block to spawn falling block and latter delete falling block and replace block again (to gravel or sand etc)
EntityChangeBlockEvent cancels the event and just updates the block. I can click the blocks with no issues. I can screen share if you want.
yea I have this source but how I tell
give me moment
yea someone bag how I tell
What???
@main dew speak human please
[22:11:22 INFO]: PACKET WRITE: net.minecraft.server.v1_12_R1.PacketPlayOutBlockChange@197d5e18
[22:11:22 INFO]: PACKET WRITE: net.minecraft.server.v1_12_R1.PacketPlayOutBlockChange@3de102b9
[22:11:22 INFO]: PACKET WRITE: net.minecraft.server.v1_12_R1.PacketPlayOutBlockChange@436780d
[22:11:22 INFO]: PACKET WRITE: net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity@49b6defd
[22:11:22 INFO]: PACKET WRITE: net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata@3a48c44d
[22:11:22 INFO]: PACKET WRITE: net.minecraft.server.v1_12_R1.PacketPlayOutEntityVelocity@f89fd77
[22:11:22 INFO]: PACKET WRITE: net.minecraft.server.v1_12_R1.PacketPlayOutBlockChange@38c81a9b
[22:11:22 INFO]: PACKET WRITE: net.minecraft.server.v1_12_R1.PacketPlayOutEntityDestroy@47767a49```
this is packet how I place one block and use this
a
Placing blocks with packets is a whole other story. I thought you just didn't want sand to fall lol
but see one event send packet how I place only one block
So I still really don't see what you want to do...
on start send to player
packet to set block,
packet to set block,
packet to idk xD
packet to spawn entity
packet to set Metadata entity
packet to set Velocity entity
packet to set block
and packet to destroy entity
yea I want do it
Well if you are using packets just send a setblock packet with sand.... That wouldn't make the block fall unless you sent a falling block packet
but see how many packets send to player when he set only one block gravel
Let me see your code
and this block for the server does not exist for some time, which in my case is also very harmful
when is a plugin actually marked as enabled?
after onEnable completes without error
I think there is an event for loaded
I don't see you sending any packets...
I have a plugin softdepending on papi, my assumption is that papi would have fully been enabled by the time my onenable is called, however some users have been reporting that the papi specific features havent been enabled whereas others have
I think there may be some sort of inconsistencies or changes from spigot to paper
yes these packages are created by this event
I think papi has a loaded placeholders event.
not when softdepend
only depend will force your plugin to load/enable after a depend
Well yeah... the server has to send the packets to the player to show a block was placed, changed to a falling block then its velocity was set etc...
So whats the issue?
make this on show hitbox
yea
hmm ok, sorta defeats the purpose of softdepend though don't you think?
Hey, I'm pretty sure I've correctly assigned variables for my maven install but mvn -version still doesn't work.
softdepend doesn;t affect load order, it only check if the dependency is there
"yea" what??? Whats the issue lol
he wants this block not to be created and not just to prevent it from happening
I don't want the server to create a falling block
depend prevents the plugin from loading if a dependency doesn't exist, i'm using softdepend as the dependency is optional
I'll just check if the plugin exists a different way
yes, but from what I remmber from going through the code before, only depend actually alters the load order
it will always create a falling block before sending the entityblockchangeevent thats a minecraft mechanic.
should probably update the wiki then
I was able to do it without these problems but had to edit the open source spigot
it does say load, not enable.
softdepend checks your plugin and loads it after the plugins listed if they are on the server. depend doesn't load your plugin if the listed plugins aren't on the server
I would imagine load implies enable, but I could move it to onLoad instead
Then might have to just edit your jar.
nah, load and enable are two different things
that was the impression I had, but apparently enabling isn't counted as loading
load = class is instanced and onLoad has run. Enabled = all of teh obove and onEnable has run
i did it but this method causes a different error so i am now looking for another method to disable physics
Unfortunately then thats the only way I can find to do it.
realise that moving the logic to onLoad is likely a bad idea as many plugins only set themselves up within onEnable
Nearly all only configure onEnable. rarely they use onLoad
thanks for try help 😕
yep
np
and i cant check if it is enabled as that is not a guarantee
it is a pity that the problem could not be solved
you can only check if it exists
only thing i can do is check if it exists but that also means if there was a problem starting up then my plugin will throw a fit as it cannot use the dependency
Only thing I can think of is cancel blockplaceevent send the player a block change packet then set the block without updating it.
you can test another plugin exists without blowing yours up
yes however I need to use the classes within the plugin
there is no guarantee that the plugin has even set itself up yet or if it did so successfully
I write about this in this place
i;ll try it on the first server tick instead
if it exists in your onEnable its main class is instanced. Just store a reference to teh plugin, then do all your enablign for that plugin 1 tick later
You can send a fake BlockPlaceEvent but the player will only see the packet you send.
Try PluginEnableEvent
thats not going to be much use at startup
i've moved it to the first server tick instead, only problem is that i could never replicate the bug in the first place so i now just have to pray that nobody opens another issue
Why does Inventory.setItem() cause so much lag?
How many times are you calling it 👀
54
uh oh, an internal flaw
does eco have FastInventory
xD
Its actually the skulls that cause the issue... I have 4 skulls in the inventory why would they cause that much lag?
dont they call the API
Yeah they do but the item is already created. I don't see why it would need to call it...
afaik it has to fetch it at least once when you actually have it as an item
how do you set the profile data? in a lot of cases it will make a request if it does not exist before
You can create the ItemStack all you want, but the item when it's set in the inventory still has to be cloned as an NMS stack
Is there a faster way? I never had issues with this before
One sec
@SuppressWarnings("deprecation")
public ItemStack createSkullItem(String username) {
ItemStack head = new ItemStack(Material.PLAYER_HEAD);
SkullMeta headMeta = (SkullMeta) head.getItemMeta();
if(username.startsWith("MHF")) {
headMeta.setOwner(username);
head.setItemMeta(headMeta);
return head;
}
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
byte[] encodedData = username.toLowerCase().startsWith("base64:") ? username.split(":")[1].getBytes() : getPlayerSkullTexture(getUUIDFromUsername(username)).getBytes();
if(encodedData != null) {
profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
Field profileField = null;
try{
profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(headMeta, profile);
}catch(NoSuchFieldException | IllegalArgumentException | IllegalAccessException e){
e.printStackTrace();
}
head.setItemMeta(headMeta);
return head;
}
return head;
}
if i have a loop in which i load chunks, i do stuff, and the loop never stops (not for a long time), the garbage collection will never run? is there any way i can force the garbage collector to run?
System.gc() I think
that will delete all unused objects instantly?
i mean, stop everything and delete those objects, and then continue
Hey there! I would like to insert a word in white color inside a text without changing the rest of the color; How could I do so?
everything it is safe to
for example
or is it threaded or something like that
I add a §f behind the heart
but then the rest of the messages is white too
how could I know the previous text color and add it after the code?
it will remove all the unnused objects that it can see is 100% safe to delete
You should never call the gc directly. Just remove any references to your objects and it will take care of things for you
How do you actually view this kind of data ?
spark profiler
Thank you
np
without player skulls (such as MHF_CREEPER) the inventory loads instantly
Creating GameProfiles is slow. Cache them if possible
Initial creation still causes the issue.
Ill cache them though for future use thanks
but im in the middle of a loop, and the gc doesnt have time to run
or at least thats what i understand
how can i get the free memory?
GC will run when it wants to. It doesn't care if you're in a loop or not
Are you keeping the refrences somewhere
im not storing those CompletableFuture objects anywhere
Show your code
im not, i think, but maybe im blind or something, this is the code
https://paste.md-5.net/karepulaco.cs
all the PaperLib.async stuff is not really async
unless youre running paper ofc, in paper i have no problem, the out of memory error only happens in spigot
Pretty sure Minecraft is going to keep the chunks loaded until the next tick or smth
I'd force them to unload if you forced them to load
yea i thought about that
but, is there any way to force them to unload?
didnt know that
let me try now
is the time it takes to allocate CompletibleFuture objects negligible or considerable? should i not use CompletableFutures if im in spigot, and only use them in paper?
with two different methods
?
why would it be faster on paper
unless you're doing 100,000,000 allocations a second then you can consider it negligible
i dont need to use completableFutures on spigot, thats what i mean
why not?
so, using them anyways, will be a problem?
ofc. not
you don't need to use completablefutures on paper
just if you use too many
because nothing is done async in spigot
oh you mean using the paper api then
yes
PaperLib uses the paper api, unless youre in spigot, then it does everything sync
or something like that, idk
the overhead from paperlib would be incredible minuscule and negligible
if there was a significant problem with CompletableFuture then i am sure nobody would be using them
maybe use them when its really necessary, and in this case its not, bc nothing is async when running spigot
wrong
only when running in paper
if there was a significant problem with CompletableFutures then it would be removed or updated :/
there are a few things being async
well, i mean nothing in that code
yesterday, after getting just 10 locations, i got the out of memory error, now it got 18 and it still works
so it seems that was the problem
I want to make a command called /find but it wont register because bungeecord already has a /find command, and when i add it to the disabled-commands section of the bungeecord config neither command registers. Do i have to make it a module instead or is there another way i can do this?
nevermind i think i found the solution in modules.yml
I mean if we see it from a conservative perspective any object creation is expensive however it’s not worse than anything else particularly.
You can use those regardless of platform. It’s in the JDK to be of general help.
Anyways if you encounter the memory errors it either because of a memory leak or because you didn’t set the max alloc ram high enough for your expected memory consumption. GC enqueues objects which are considered lost in reference and then it runs a collection and free some space every once in a while, can be adjusted with jvm args.
In this case Minecraft was keeping a reference internally preventing it from being GC'ed
Oh ofc you could invoke System.gc() but that’s like saying please gc for the sake of my love do some work.
Oo yeah
I have a command for that lol

http://prntscr.com/1n28o6y
i have this yml file is there a way to get all the keys of Map1?
like .getChildren("Map1") which will return ["loc1", "loc2"]
call System.gc every tick for optimal memory use 
.getKeys
Is there a way to make the information packets for the text content of a sign not be sent to a player unless they've already loaded the chunk it's located in? (At least since the last time it was changed, the last time the player connected, and/or the last time the server has restarted)
I'm trying to figure out a way to prevent people from using search tools to compromise locations through locating specific signage. (Very helpful against things like casual griefing and stream sniping.)
Ideally, I'd also be able implement a simple form of encryption on those data packets (using the chunk data and block coordinates as the decryption key) so that it's even harder to find the location of a sign through brute force.
However, that could be very resource intensive.
Ping me when you respond, because I get the feeling it could be a while.
how do i teleport a player to a certain position for example to 200 70 52?
Player#teleport(Location)
why i cant do this null == 1?
i mean, it should be false
that null is delay, and its an Integer
Unboxing of 'delay' may produce 'NullPointerException'
a primitive can't be null
because null is an object, 1 is an integer
You can't compare objects and integers
well primitives are special in that they can't be assigned to null either, so it doesn't make sense to permit comparing them either
i suppose you will have to intercept every chunk packet https://wiki.vg/Protocol#Chunk_Data and check the block entities, i'm not entirely sure how you would go about implementing your 'encryption' though, since the client won't know how to decrypt it
It would probably require a datapack installed on the client
You would need to use Protocol Lib and monitor all packets which require chunk/block info
check the distance from the requesting player and allow or block them.
@fluid cypress when you do <Integer> == x, it tries to cast the integer to an int and then compares the ints
The casting fails if your integer is null
It doesn't happen with other objects because both a null object variable and a non-null object variable are essentially pointers
So no cast is needed
It only compares the address not the contents
got it
im using this maven plugin to set the jar output
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<outputDirectory>../Server/plugins</outputDirectory>
</configuration>
<version>3.2.0</version>
</plugin>
how can i make it compile 2 jars to 2 different locations?
can someone help me witht the plugin shopgui+ im trying to add spawners i made a section but dont know how to add them to the shop
?paste
whats paste
a pasting site for code
https://paste.md-5.net/lezinequga.java
So i'm having an issue getting a location the config section "locations", the generators I have work however when I reload/ restart the server, I can't get the location from the config. I have been stuck on this last part for 2 days and I would greatly appreciate any help with this config issue. Thanks.
what is the best way to load two custom worlds on startup? only way i see is guessing how long it could eventually take... and i dont need to explain why thats not good
(because i dont really think i want to load two worlds at the same time)
a code tip
distanceBetween should be Location#distance(Location)
i think thats the method name
and also how do i get all of these values? http://prntscr.com/1n4q8o6
same thing
Ok, how do I set the config variable
oh wait nvm ik what iw as doing wrong now
config.set(path, value)
how do i create a jar with a module and parent
child module: https://paste.md-5.net/osagijapap.xml
parent module: https://paste.md-5.net/simomutaya.xml
Failed to execute goal on project ConfigGuiExample: Could not resolve dependencies for project me.imaginedev:ConfigGuiExample:jar:1.0.0: Failure to find me.imaginedev:ConfigGuiAPI:jar:1.0.0
in player throw egg event, how do i check if the egg hit an entity or not
declaration: package: org.bukkit.event.entity, class: ProjectileHitEvent
you can add metadata to the egg to make sure its from your plugin
ok seriously intellij, in what world is !Objects.equals(string, string2) a better solution than string != string2
intellij pls
you're drunk go home
nah intellij is right in that case
how?
it accounts for null
don't they both do that?
well one may be null
null.equals(object) // NPE
object.equals(null) // False
Objects.equals(null, null) // True
I mean sure but doesn't != also deal with null just fine
because it looks like it is
if (obj == null) {
return;
}
if (!Objects.equals(a, b)) {
return;
}
but the second one may mean that both are null
I'm confused, can't you just do a != b and have the same result
bro what
public boolean equals(Object a, Object b) {
if (a == b) return true;
if (a == null) return false;
return a.equals(b);
}
this is literally objects.equals
you mean Objects.equals right
jfc man
what, they aren't the same
😠 😠 😠 😠 😠 😠 😠
you feeling ok there imagine, I think nnya rubbed off on you
are you ok?
i just explained it like 5 times
/*
Equivallant to Objects.equals()
*/
public boolean equals(Object a, Object b) {
if (a == b) return true;
if (a == null) return false;
return a.equals(b);
}
mmm can a teleport cause return an enum?
if(event.getCause() == Material.CHORUS_FRUIT)
asking since this is giving me an error that i'm not sure how to fix
its in PlayerTeleportEvent by the way
you're comparing a TeleportEvent.Cause to a mateiral
wait it's an enum though?
declaration: package: org.bukkit.event.player, class: PlayerTeleportEvent, enum: TeleportCause
if its actually a string, what intellij suggested is best since it handles all scenarios and fixes the comparison
you're comparing the pointer of the 2 strings.. Which the jvm can store specific strings in memory with a consistent pointer but you shouldn't trust it
oh wait, so i forgot that PlayerTeleportEvent had enums in it like this
if(PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT == event.getCause())
so would this work?
you should flip that
?
if (event.getCause() == PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT) {
}
i see that, but what difference does it usually make?
better code style
oh, alrighty then
wait.... how does one tell which one should go first or second?
methodCall -> Constant
for strings it should be reversed
if ("myString".equals(nullable)) {
}
ohhh, i c i c now, thanks
what
Just looks weird when you call a method on a constant like that
I normally do it the other way around and handle the possible null
it looks weird but i always do it
I think I've been looking at code for too long, my brain is melting
on the upside it was for a worthy cause, I think everything works
[ERROR] Plugin org.apache.maven.plugins:maven-jar-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.5: 1 prob
lem was encountered while building the effective model
[ERROR] [FATAL] Non-parseable POM C:\Users\wsmit\.m2\repository\org\apache\maven\plugins\maven-jar-plugin\2.5\maven-jar-plugin-2.5.pom: end tag name </head> must be the same as start tag <link> from line 7 (
position: TEXT seen ...</style>\n </head>... @31:10) @ line 31, column 10
[ERROR] -> [Help 1]
You have problem with your pom.xml
Post it here
I have 3
3 pom.xmls in one plugin?
*4
Why?
is there a reason sometimes world.getblock sometimes doesn't work for me? (using 1.8.8 spigot)
it happens pretty rarely though
in one plugin or in one project?
One project and compiled into one plugin
epic
So post the upper one pom.xml
Try cleaning the local .m2/repository/ folder manually
aight
is it possible to pause either a plain java runnable or bukkitRunnable
wdym pause
if (condition) {
}
simple
You are using bukkit scheduler?
worked thanks
like pause for 1 sec
probs should have thought of that myself lol but whatever it works now
[06:29:59 WARN]: Nag author(s): '[Rivex]' of 'SSP' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).```
is that actually a spigot thing, or paper? lol
spigot
interesting. spigot now annoys me when printing out stuff for testing lol
is it possible to change the period of each runnable
like have a int inside the runnbale
adn update it in the run method
is there a way to get a specific mob skull with; SkullMeta#setOwner ?
and have it change the delay
huh?
just get the item
or set the block material
in 1.8
1.8 is old-ass
and i kinda start to hate those 1.8 HaS BeTtEr PvP SyStEm people lmao
not my choice, i just making the plugin for the server
bump the admin lol
lmao
i still wonder how you can hire a developer for 1.8... that's just hillarious
bumpitty bump
bun bun
dun dun
no idea :3
da dun da dun da dun dunnnnn
sorry
okay
this.
oh lol, thought you meant smt from me lol
https://pastebin.com/jvL6V9sL
what do you think?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i hate it
hi guys, i have a question
I saw that some plugins we managed to put in Maven and already get the API from there
what's up with all the br people in here lately
when I put a plugin directly into Maven, does it need to be on the server?
that isn’t grammatically correct
sorry, its google translate, bruh
I assume you mean when you depend on something in your plugin, do you need to run it with the server as well?
Because if that's what you're asking, it depends. You can either build it into your plugin (compile scope), or tell it that it will be there (provided scope). If you're depending on another plugin, you probably will use provided.
no, if i add the some plugin into my plugin's maven, the plugin (in maven) needs to be in the server?
thats my question
Yeah I think we're on the same page just saying it differently.
i too
your sentence structure gets lost in google translate
google translate sucks
If you're adding a plugin into your maven, set the scope to provided and run it on the server
If you're adding a library then set the scope to compile and don't put it on the server
🤔
depende, há certas configurações de maven que funcionam ser ter de ter o plugin no teu servidor
alright I'm done creating config systems, I'm going back to home renovations
sOra yes
gimme s2
XD
weebs and brazucas, my life is a living nightmare
like what?
like what dessie said earlier
you're better off reading guides online
i will search now
thanks men
de nada 🇵🇹
🇧🇷
how do you use PDC in tile blocks ? nvm I was doing a stupid mistake that's y my code was not working and I suspected that there is a new way.
why does world.getblockat sometimes say the block is air when it's not
will world.loadchunk do anything to stop it from saying the block is air
Is there a easy way to make the server slower?
like deliberately lower the tps
To a certain amount
NMS
So modify the server?
^^
look up this https://github.com/BananaPuncher714/Overdrive
Is it exactly the effect of lagging?
Like server can't keep up too much things to calculate
Oh also what's the rant with easy mode about?
should i compare worlds by name?
name, id or instance. all work
if (Bukkit.getTPS() < 20) Bukkit.setTPS = 20;
Hey, so my question is how to spawn an Entity with a custom skin
I already searched for it on google and I am able to spawn an EntityPlayer per nms but how do I interact with the newly spawned Entity? I know that the PlayerInteractEntityEvent doesn't fire because the Entity is client-side and not server-side
I didn't find any help for that problem except that I should use ProtocolLib but for that I don't find any help either..neither for spawning nor for interacting with it
Dunno if I'm too stupid to google xD
https://gist.github.com/nimbl0/f3606b489016a2d7dba9da5ac4a5d7e7
This is my current class for spawning the NPC
I'm fairly new to NMS 😅
CraftWorld do
you will have to use packets. USE_ENTITY iirc
hm but how?
Do I have to do something like in the spawn() again? Instead of ADD_PLAYER it's USE_ENTITY?
That's confusing me a bit
USE_ENTITY is a packet you should listen to
store the entity ID of your EntityPlayer and check in the packet listener if the used entity is your player
is there a good way to serialise and deserialise an object
GSON
hmmyyeahh i didnt think of that
Yea but how do I listen to packets? It seems there are some Events/Methods in the Spigot API itself but I dont know which?
https://www.spigotmc.org/threads/packet-listener-using-netty-tutorial.69772/
Or do you mean something like this?
i was so confused till i realised game activity
i thought i had pushed or something
ProtocolLib would be the easiest way here
It has fields:
Location
Set<UUID>
DroneInventory
Sometimes I feel soo dumb lmfao...I googled "protocollib tutorial" and the github page of protocollib gives me exactly the information I need
2000iq
thanks xD
:D

what is Parcel supposed to do?
right apparently there is an
@Expose
yea u have to define which fields gson should include
it represents a delivery once finished
and you name it Parcel?
we already had something like this. do a DeliveryResult or smth
that would make much more sense
and is just a wrapper for the provided informations
meh
so we can evaluate them
java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.Object java.lang.ref.Reference.referent accessible: module java.base does not "opens java.lang.ref" to unnamed module @2aa5fe93 bruh

Ohhh, gson
Yeah it has trouble with the new java version. Well the version of gson that Minecraft ports at least
turns out i needed a Gson builder
although...
@Expose
private final Location location;
@Expose
private Set<UUID> authorisedPlayers;
@Expose
private final DroneInventory inventory;
{"location":{},"authorisedPlayers":["MY_UUID"],"inventory":{}}
is it cause gson dont know how to serialise them or something
Okay so I've not used protocollib a lot but I want to use the Entity Position (https://wiki.vg/Protocol#Entity_Position), How can I use this? PacketType.Play.Client.POSITION uses the position event and something like PacketType.Play.Client.ENTITY_POSITION doesn't exist.
how 2 make player execute command on bungee
tell quicj\
chiop chioop
..?
Ok thanks
np
fr tho
how to make a player execute a command on bungee
yk liek
a bungee plguin
tell quick
ProxiedPlayer.performCommand(String);
bad
ProxyServer.getInstance().getPluginManager().dispatchCommand(sender, commandline);
k
i just6 farted
are you dumb?
Do you really think it's funny or will anyone care that you just farted?
My project folder structure is Minecraft > Plugins > ProximityChat,
On InteliJ when I go to files>project structures>artifacts>add>JAR>using modules from dependencies it keeps forcing me to using Plugins and not the ProxmityChat which is my actual project file.
Moshi > Gson
myeah idrk
You should probably provide a TypeAdapter for DroneInventory and Location
hmm maybe
inventory={inventoryType=DEPOSIT, location={world=world, x=90.0, y=88.0, z=120.0, pitch=0.0, yaw=0.0}, inventory={}}
having an issue deserialising this
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 35 path $.
Yeah
Soo I know how to listen to a Packet but how do I determine the type of the clicked entity?
protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.USE_ENTITY) {
@Override
public void onPacketReceiving(PacketEvent event) {
if(event.getPacketType() == PacketType.Play.Client.USE_ENTITY) {
PacketContainer packet = event.getPacket();
System.out.println(packet.getIntegers().read(0)); // i looked it up on google and it seems like this gives me the entity id? but in my case it's 28...which is a skeleton horse and not a EntityPlayer or something like that
}
}
});
Okay so I've not used protocollib a lot but I want to use the Entity Position (https://wiki.vg/Protocol#Entity_Position), How can I use this? PacketType.Play.Client.POSITION uses the position event and something like PacketType.Play.Client.ENTITY_POSITION doesn't exist.
well entity position is sent by the server, and I believe it's PacketType.Play.Server.REL_ENTITY_MOVE
ty
what version
1.16.5
thanks
How disable physics gravel, sand etc?
help
you need a plugin for that
what plugin?
use google and find out...
I check realy
i think worldguard can do that.
yea worldguard have this option but this option don't work 😅
it should work..
how to get telleporteeee with ess api
yea
should work != work
what blocks do you want to not have gravity?
all 😅
if you can i will be very grateful
I can't find good plugin or good source to disable this
is there an event for totem of undying being used
EntityResurrectEvent
how can i check if my config.yml has a path homes.uuid.somename and i dont know the value of somename?
like i have to check if there exists something under uuid
like now i'm adding every key under uuid to a list and check if that list isnt empty
i assume there are more efficient ways of doing this?
.getKeys.size
Someone knows a good license system? (I dont want AdvancedLicense, its outdated.)
and whats the difference again with .get() and .getConfigSection() ?
You is trying to get it as:
a:
not:
a:
b: 'c'
not?
I dont saw the code, but i think it is this.
ye it's called free and open source
Im bad with php ' -'
all the more reason to make it open source
i want to get the item that caused it though.
basically i just want to get the name of the totem that was used
what is faster?
if (...) {
do something
return
}
do something else if false
or if/ else?
How disable physics gravel, sand etc?
none.
its up to you what you like more. implicit or explicit else
yea i already got answer xd
Yeah, speed isn't the issue. It's design patterns. The more widely accepted approach is to if/return so you're not nesting a dozen if statements within one another
okay thanks
You should be able to just get the item in the entity's hand
event.getEntity().getEquipment().getItemInMain/OffHand()
You'll have to check in which hand it is because the event doesn't supply you with the item (though it probably could)
i wanna check if a player got banned then register his ban reason and stuff in config, what event do I use
Just a fast question, can u make a package in a package in your plugin?
I just realised Bukkit.getPlayer() also works with partial names...
Just a fast question, can u make a package in a package in your plugin?
a directory yes
oki ty
If two people have the same inventory open they are linked right?
Cool thanks
maybe something to use on my trade plugin but it goes brr
what?
linked inventories
ah right
Why not make your own ban command?
i have now two interventories that react on eachother with an event :/
but you can only place items in the left part of the inventory so i dont know how it will look when they have the same inventory open
Just open up a new menu where one player can place on left side and one can place on right
well my idea was that both place on the same side
You could but it definitely makes it aids for no reason
ppl use other cmds
Wdym?
like essents
Yea probably kickevent then
That's why there's Bukkit#getPlayerExact()
It's actually more performant if you use it over #getPlayer() in a situation where you know for certain a player name is a valid one
(though for commands, you're always best to use #getPlayer())
is there also a way to get players which is not case sensitive (not the normal getplayer) 😄
Can anyone help me with generating and loading a texturepack? I have written code to generate all the json files, and it all looks right, but when I load the texture pack no textures, settings, or anything loads. Not sure if it's a problem with my zip function or what
How disable physics gravel, sand etc?
can you send the texturepack so i can take a look at it?
Yeah one sec
Assuming you have a pack.mcmeta in there as well
Yeah it looks like a normal pack
I think it's either the json formatting or the zip function
i wanna make a plugin
in which if we eat we get random mob spawned
can anybody help?
if yes then please ping me
where is the best player to use LivingEntity#setCollidable(boolean b) ?
You could make an ArrayList, add all EntityTypes that should get spawned and just get a random with:
Random random = new Random();
list.get(random.nextInt(list.size()));
but i think could be more efficient
?
what ?
?
Ummm looks nice but the big question is What are arraylists?
yes
just a list
ok
and learn java 😄
so i can get documention on arraylist in spigot.org
arraylist is a java class not really spigot specific
google will be enough to get docs/tutorials
works same in spigot?
for example
list.add(EntityType.CREEPER)
its not a string you add
it has to be an entity
public class Main {
public static void main(String[] args) {
ArrayList<String> cars = new ArrayList<String>();
mob.add("Skeleton")
}
and it is List<EntityType>
something like that
public class Main {
public static void main(String[] args) {
ArrayList<String> mob = new ArrayList<String>();
list.add("EntityType.SKELETON")
i'mma test it out
on intellij
?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.
is there a learn spigot tag?
no
this would be the right time XD
No but that’s quite trivial after knowing Java
true
you can do nickname
nickname?
ah
it is'nt working
public static void main(String[] args) {
ArrayList<String> mob = new ArrayList<String>();
list.add("EntityType.SKELETON")
heres what i did
Ye why main
see
yes
on the eat event
@full spruce maybe read this first and come back if you understand a bit more?
https://ethr.medium.com/how-to-make-a-spigot-bukkit-plugin-for-minecraft-part-2-base-plugin-3ac5385155f7
public final class Main extends JavaPlugin {
@Override
public void onEnable() {
List<String> list = new ArrayList<>();
. . .
}
}
Meh
why are people in this server so against using ?learnjava
still the ovveride
?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.
Fixed
@full spruce you don't need the main method, that's your main class (w/o onDisable(), add it)
Inside onEnable() do what you need
And learn java
wait
use events
i mma come after few mins
Idk he says in plugin enable
import org.bukkit.ChatColor;
import org.bukkit.entity.Explosive;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import java.util.ArrayList;
public class FirstEvents implements Listener {
@EventHandler
public static void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
player.sendMessage(ChatColor.LIGHT_PURPLE + "Welcome to the server");
public static void main(String[] args) {
ArrayList<String> mob = new ArrayList<String>();
list.add("EntityType.SKELETON")
}
whoa
Someone knows why my code give me a NumberFormatException when i enable method name obfuscation?
?paste
public class First extends JavaPlugin {
@Override
public void onEnable(){
getServer().getPluginManager().registerEvents(new FirstEvents(),this);
System.out.println(ChatColor.AQUA + "Plugin is enabled");
}
@Override
public void onDisable(){
System.out.println(ChatColor.RED + "Plugin is disabled");
}
he says whenever someone eats spawn random mob so eat event or something
Method inside method
🙈
i was trying to do something🤣🤣🤣🤣
well show it up 😛
?paste
i mma come after few mins
wait what a main method inside a listener
Its AdvancedLicense code, i said my code, because is my plugin, lol.
Ill send
uhh oh
Main method inside onJoin method
lol
imagine compiling this without errors lol
🎷 🐛
Compile an Minecraft plugin using javac
😖
then intellij seems to be more users friendly
IntelliJ IDEA is better
AdvancedLicense Code with some modifications:
https://paste.md-5.net/utihakumal.java
I want to know, why when i enable method name obfuscation, it gives me a java.lang.NumberFormatException: For input string: "K", but when i dont enable method name obfuscation in my obfuscator, it goes.
OBS: (It only give me a error on this, dont in the whole plugin.)
(This error is on xor function)
true
which line?
not going to search through this whole code
I edited, (this error is on xor function)
oh god
Line 122.
I already tried a try and catch, but if i do that, it dont returns the value that i want.
And... when i dont enable method name obfuscation in my obfuscator, it goes.
wel i dont know anything about bytes and xor and stuff
i am here
😳 😄
what are yo doing?
what are u trying to do?
if i eat i get a random mob spawn
and does it work?
nope
can yu show your code
send your code so far
😳
o.o
?paste
ok
package com.project.first;
import com.project.first.events.FirstEvents;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
public class First extends JavaPlugin {
@Override
public void onEnable(){
getServer().getPluginManager().registerEvents(new FirstEvents(),this);
System.out.println(ChatColor.AQUA + "Plugin is enabled");
}
@Override
public void onDisable(){
System.out.println(ChatColor.RED + "Plugin is disabled");
}
?paste
the link was used for something..
yes
and where is your event that handles the eat event
not made yet
well where are you waiting for
make that
the rest looks good
thats the question how
?
you have a onPlayerJoin event
Use PlayerItemConsumeEvent
make one for when a player eats
same class as onPlayerJoin
oh
hmm there is no eat event
.
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "works.net.Worksnet.getCommand(String)" is null
```why
is this
happening
to me
yes
defined your command in plugin.yml?
^ Put it in the plugin.yml
🥺
public static void onPlayerItemConsumeEvent(PlayerItemConsumeEvent event) {
Player player = event.getPlayer();
this is the code so far
any more things to add?
hey what is a good way to get all entities spawning or something? i want to disable collision for all of them the same for players?
Well you need to spawn the random entity...
thats the question how you do that
do you know a better way to spawn a random entity rather than putting all entity types in a list and picking a random one?
seems such a waste
spawnRandomMob(ArrayList mobs)
then onPlayerEat or ever is just new ArrayList and then pass that list into spawnRandomMob
i would say prepare the list on enable
yeah
hey, does Bukkit.getScheduler().scheduleSyncDelayedTask() run in background or does it delay to following statements too?
just a for
public static void onPlayerItemConsumeEvent(PlayerItemConsumeEvent event) {
Player player = event.getPlayer();
ArrayList<String> mob = new ArrayList<String>();
mob.add("Entity.CREEPER");
mob.add("Entity.SKELETON");
mob.add("Entity.ZOMBIE");
mob.add("Entity.HUSK");
System.out.println(mob);
it runs later
so this is the code so far
so the second?
dont println(mob)
If you don;t use the timed one, then it runs the next tick, or attempts to
do you want to add all the entities?
ok thx
or u could just use that list..
oh smh true
rather than copying on list to another list
i got the idea of that arraylist in my head
okay so we dont need the serperate method then if we have the list already
just get a random element in the EntityType.values() list
where
just add it directly and use an EnumSet
?paste
i need this for a sec
ignore it
what version is this plugin btw
wait
ok
Error: https://paste.md-5.net/abuyedajal.sql
Code: https://paste.md-5.net/dumivivayu.java
I set the meta data in a command
i dont see whats wrong
or maybe im blind
You're also only checking on the first one if p.getEquipment() is null, not the item itself.
i literally set the metadata ```java
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (commandSender instanceof Player){
Player p = (Player) commandSender;
ItemStack i = new ItemStack(Material.TOTEM_OF_UNDYING);
ItemMeta m = i.getItemMeta();
m.setDisplayName("Totem Of Teleportation");
i.setItemMeta(m);
p.getInventory().addItem(i);
}
return false;
}
doesnt matter
i get this xd
event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), Arrays.stream(EntityType.values()).collect(Collectors.toList()).get(new Random().nextInt(EntityType.values().length)));
EntityType.values()[ThreadLocalRandom.current().nextInt(EntityType.values().length]
and spawn it
redundant stream
And then pray it doesn't pick Player 
no risk no fun
Absolutely true
event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.values()[new Random().nextInt(EntityType.values().length)]);
otherwie use this class https://github.com/Luziferium/AsyncSpawnMob/blob/master/src/main/java/de/luzifer/asm/api/mob/Mob.java
add this too?
what is the difference with the threadlocalrandom?
add this too?
it contains the spawnable mobs from 1.8 to 1.17
take mine or that from him idk
yours will throw exceptions if its not spawnable
oh
and if it hits the exact length of the artay
@full spruce no need for the tabs line 4-8
since indexoutofbounds
idk if thats in the code or just the paste
i want only undead mobs
yeah that are undead mobs
otherwise remove the entities which arent just like Firebalö
Firebalö
FIREBALL
fuck my phone
it is showing armour and
What do I do to fix it. Jesus christ, I really am blind.
i didnt find the .get XD
check if the item is not null, if the meta is not null
For both the Main hand and Offhand items ^
^
this code will do nothing at all
We need a command for that 
or remove
ya
what
but without the HEY SUB ME LEAVE COMMENT
True
what should i add
array?
created but never used
Do you only want to be able to spawn those 4 mobs?
look at my code and add the spawn entiry part
where's your code
,
crap code
then?
creating everytime a new Random instance is not needed
then?
ThreadLocalRandom is faster too

