#development
1 messages · Page 105 of 1
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
(Sophia) in part you're trying to access an element at an index before checking the args length
you never assigned locationraid to anything
final org.bukkit.Location locationraid = new Location(Bukkit.getWorld("world"), 102, 67, -25);
Right there I did
and you assigned it static cordnates?
102 67 -25
@lyric gyro could you reference where I did that?
@lyric gyro did you check your cords in f3?
Yes
and also broadcasted it
coords match
there are dozens of command frameworks you can use, but this is a basic understanding of arrays, you're doing this:
Say for instance I type /cmd whatevs a
if (args.length == 1) { // false
// ...
return arglist;
}
if (args[0].equalsIgnoreCase("item") && args.length == 2) { // fails first condition
// ...
return arglist;
}
if (args[1].equalsIgnoreCase("spell") && args.length == 3) { // fails second condition
// ...
return arglist;
}
if (args[2].equalsIgnoreCase("bind")) { // oops! there is no args[2]! throw
// ...
return arglist;
}
are you able to use equals on cordnates?
Yes but it has to be exact, I'd suggest converting toBlockLocation (or whatever it's called) in any case
idek how to do that
with the method I just mentioned
They're fully fledged command frameworks, not just for tab completion, but these are the ones I know of (also they're annotation based (except for cloud which can be either annotation or builder based) which I dislike but hey ho)
ACF https://github.com/aikar/commands
Triumph cmds https://github.com/TriumphTeam/triumph-cmds https://mf.mattstudios.me/mf/mf-1
cloud https://github.com/Incendo/cloud https://incendo.github.io/cloud/
RedCommands https://github.com/Redempt/RedCommands
How abt his
this
Block loc1 = block.getLocation();
How would I get that
where when they right click a block
it gets the location
you will need to add a command instead of right click
where it gets where the player is standing when they issue the command
eh?
I dont know how you would go about right clicking
javadoc can be quite daunting if you're not familiar with them but they are VERY resourceful
just knowing how to navigate them
I understand them
Im not new to coding just new to bukkit plugins
I dont remember functions till I use them a few times
but I looked at the frameworks you send me and none of them really suit my taste
I also googled for more
but I still dont really like them
I may use the template I showed but I have to recode and find all the libraries
well for classes I can just copy and paste
I will try the template and see if I can get it working
its a good template
framework
Cannot resolve symbol 'getAction'
if (event.getAction.equals(Action.RIGHT_CLICK_BLOCK)) {
it's a method
()
?
huh
you're missing the parenths
where at
getAction
oh
I see
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
like that
that'll work yeah
So like that
jesus christ
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
as a side note: when you're comparing enums (like Actions or Materials) and primitives (ints, longs, chars etc) you should use ==; for everything else .equals
ok
Would it work tho
testing rn but
its slow
that looks about right
or at least I don't see anything immediately wrong
It works
okay so
Say I wanted it to do
like a skull
Wait
sorry trhat made no sense

What if I wanted it to teleport everyone in the distance of 4 blocks
if its slow you could optimize your imports
Well there's this https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getNearbyEntities(org.bukkit.Location,double,double,double) which will give you all entities in that world within those distances from the given location, the teleport each of those to wherever
You can get the world from the clicked block or the player (getWorld()), same thing really
maybe you should make a local server and directly build your jar into the plugins
Doesnt ! mean like
its not
else if (!player.getItemInHand().getType() == Material.IRON_INGOT) {
ah darn time to make this plugin inside a framework T~T
a != b
doesnt work
else if (!=player.getItemInHand().getType() == Material.IRON_INGOT) {
Expression expected
Unexpected token
';' expected
Unexpected token
no
(player.getItemInHand().getType() != Material.IRON_INGOT)
hand item is not equal to iron ingot
not
ty
not not handitem
you would just be saying not handitem but is equal to iron ingot
well your saying not player actually
so no player is == iron ingot
thats what you were saying x3
event.setCancelled(true);```
I wanna do it
if they dont right click the prismarine
it cancels the event
not like
where they cant place it
?
got it
nvm
How can I make it so like
it makes a whole new world
with maps and everything
like generates one
get a library of multiverse and use its api
anyone have any idea where the symbol trituple is from
private static final Map<Command, List<TriTuple<Object, Method, Command>>> arguments = new HashMap<>();
I trying to get this framework working
christ
?
what
wdym
.
is it only on eclipes?
well this framework doesnt list the library that used Trituple
cough jdk cough
im using jdk 16
just make a record then
I cannot get the files to import properly it stops on the java file or symbol
fixed it
went to build and it came out with 100 errors...
maybe its time to build with an updated framework...
there are no errors in the project just in the building
nvm fixed it
Can I
In any way
have an abstract class (public abstract class SomeEntity)
extend a class...
but like
public abstract class SomeEntity extends <? extends LivingEntity>
That's just an example not supposed to make any sense, you can replace the class names with anything
But I want it to extend a wildcard..? which is a class that extends a specific class though
Short answer, no
F
Cause I got a lil issue where
I got a class which has a lot of data
Which needs to extend PathAwareEntity, but I also need that same exact class to possibly extend AnimalEntity based on the need
How would I avoid creating two separate classes which extend those two things
And have a LOT of repeating code
java.lang.IllegalArgumentException: The embedded resource 'src/resources/options.yml' cannot be found in plugins\MagicTools.jar
https://pasteboard.co/ifJrp8KLsOhO.png
For some reason its not able to find it
fixed it
Hi! One thing! Can I cancel the Player Move Event on the OnJoinEvent ? Because I would like to cancel the movement until they write a command on the chat. I don´t know if I explain well. Thx
when they join the server put them in a list and when they move remove them from that list
then make a check on the chat event if they are in the list
if they are, say that they need to move
and cancel the event
i don´t understand very good the idea
Scoreboard/Saving and loading config/command handler
it would be also nice to have a system that you can tag items and bind a script to it
as thats a main function of this plugin
but I expect I will have to do some digging in open source api for that one
its more like an rpg framework
thanks this is a good command framework
does anyone know of framworks for saveing and loading and scoreboard?
and possibly item tagging
item tagging?
to attach a script to it
What exactly you didn't understand?
umhh, idk about that
its done in plugins like itemadder
but for config https://secretx.gitbook.io/sc-cfg/
thanks again
NBT api will give me item scripts
if anyone has any suggestions on a scoreboard framework let me know ^~^ otherwise I will do some digging
Just handle it yourself, it's really not that hard
kek just remake spigot loser
should each subcommand have own class?
yes
is there a tutorial bcs i dont know where to start 😄
i would just use matt framework for commands 
java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.ProtocolManager.sendServerPacket(org.bukkit.entity.Player, com.comphenix.protocol.events.PacketContainer)" because the return value of "com.comphenix.protocol.ProtocolLibrary.getProtocolManager()" is null
i dont understand why the protocolmanager (protocollib) does not work
providing your code is useful
also you probably implemented protocol lib into your plugin instead of compiling it
@thick kestrel if you just wan an AIO framework I suggest https://github.com/lucko/helper
instead of stitching something up with many smaller frameworks
@lyric gyro no thanks I want to keep my compiling size low
I've nicked you as I can't stand untypable usernames
I mean it's not even that large and it will probably be near if not even smaller than your Frankenstein'ed plugin lol
I dont like the wiki theres no examples
excuse me?
on lucko
there very much are examples
I dont see any
if you're gonna """"read the wiki"""" at least read it deep enough to ensure what you're saying is true
ok I found examples


but I dont like the coding style x3

I think the other ones keep it much more simplier and readable when it comes to updating
my personal suggestion: just stick with the bukkit api, it's not that hard... it does have a few sharp corners you'll want a helper for (like commands) but other than that it's not really that big of a deal
Emily, just accept it, you're a noob
frosty stfu no one likes you
Hey that's not nice 😦
sez u
okay mr "trynna"
x3
Do I even want to ask why you got so many of the same emoji?
x3
no you don't
on topic is this channel note
We are always on topic
utmost importance
topic = hotdog.pvp();
we never go off topic here
I have kind of a stupid question, but when things seems so simple there must be something wrong: In a context of limiting a method param to an Iterable<?> instead of a Collection<?>, what would be the difference between using Collection#isEmpty vs Iterable.iterator()#hasNext?
isEmpty would be slightly faster in that it would avoid object creation
But functionally they're identical
I couldn’t tell if that was a machine gun with a coffee cup or a cat with a coffee cup
Turns out it was neither
Very sad
🤨
I'll rephrase this
I got class EarthboundEntity, which extends PathAwareEntity.
I got another class, EarthboundAnimal. It needs to extend EarthboundEntity, but it also needs to inherit fields and methods from another class AnimalEntity. What should I do...?
Don’t ask okay, it’s not worth it
AnimalEntity is abstract and is pre-existent. Same goes for PathAwareEntity
You need to class to derive both AnimalEntity and PathAwareEntity?
that is not possible
Hello,
my problem is that ProtocolLib does not work correctly. I get the following error message:
java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.ProtocolManager.sendServerPacket(org.bukkit.entity.Player, com.comphenix.protocol.events.PacketContainer)" because the return value of "com.comphenix.protocol.ProtocolLibrary.getProtocolManager()" is null
My corresponding code for this:
https://prnt.sc/2214t67
What build tool do you use, gradle or maven?@mortal timber
maven
Right, make sure the scope of plib is provided
How exactly should I do this?
<scope>provided</scope> unside protocollib <dependency> block
Strange, I only have this:
<dependency><groupId>com.comphenix.protocol</groupId> <artifactId>ProtocolLib</artifactId
<version>4.7.0</version>
</dependency>```
i'll try
It works, thank you very much. But why was that the error? I didn't need it with older versions.
Yeah but what is a solution then
Or an alternative
or is there no solution
I will just need to have repeating code in EarthboundEntity and EarthboundAnimal
Maybe I'd be better off having EarthboundEntity be an interface?
smtng like that
or have a class with the common logic
then just use instances of that class
yeah I guess
you can even have an interface which exposes an accessor of that common class if you need multi-inheritance or whatever you'd call it
So many dilemmas
I made an interface now called Earthen instead of the EarthboundEntity class
Thing is that all the classes implementing Earthen will have a method createAttributes()... but the method will vary slightly for each instance and NEEDS to be static
So I cannot have it in my Earthen interface
So I have to repeat creating a new createAttributes() method in each class..? Is that fine?
You can have static methods in interfaces, or whats the problem?
The method differs between each instance
So one class implementing Earthen might need the method to change slightly
what's a good representation of a 3D regtangular prism?
nice hat fred
{
"start": {
"x": 0,
"y": 0,
"z": 0
},
"end": {
"x": 0,
"y": 0,
"z": 0
}
}
does this make sense?
thanks
Anyone know a free host that lasts for like an hour and allows me to upload my own plugin for testing purposes?
server.pro I believe allows your own plugins now
appreciate you
Or you know just self host
min and max sounds better than start and end
👍
Well, actually I believe that's an official naming
official in what way?
in the way min max makes more sense
well yeah
also,
in one-dimensional space, given 2 lines that go along that one dimensional axis that currently don't overlap, what's the best way to find how far it can move before it overlaps?
I could do a bunch of if/elses but that seems over complicated
Math?
there's probably an equation for that
do you mean two dimensional lol
XD
This can probably help fred: https://www.cuemath.com/geometry/intersection-of-two-lines/
no I don't?
I mean one dimensional
xxxxxxxxxxxx zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
^ ^
finding the distance between those two points
oh right
google is only giving me 2D stuff
indexOf(last) - indexOf(first)
but the issue is I don't know which 2 points are closest
what if it was the other order for examle. z than x
also not 1-dimensional
get first index of x and first index of z then and compare.
How do i detect if a player is looking and can see another player? so far i stole this piece of code: ```kt
private fun getLookingAt(player: Player, other: Player): Boolean {
val eye = player.eyeLocation
val toEntity = other.eyeLocation.toVector().subtract(eye.toVector())
val dot = toEntity.normalize().dot(eye.direction)
return dot > 0.99
}
an idea that i just thought of was to ray trace blocks and see if the closest block distance is farther than the player's distance but i feel like that might be buggy
and I'm also running this every tick
d;spigot livingentity#haslineofsight
boolean hasLineOfSight(@NotNull Entity other)```
Checks whether the living entity has block line of sight to another.
This uses the same algorithm that hostile mobs use to find the closest player.
other - the entity to determine line of sight to
true if there is a line of sight, false if not
iirc that returns true if you're not looking at the player
i mean maybe i can combine both?
i think i used it before this
ill try combining both
hm
i mean it sort of works
but

lol
two bugs:
- if im too close, then only the head works
- if im too far, then i can be looking a bit away from the player
and
- if im looking at a block but can still see the other player, it works (since thats how hasLineOfSight works)
:((
why there no rayTraceEntities
in paper
1.18
wait there is??
probably
why would there not be
theres World#rayTraceEntities
i was looking at Player#rayTraceEntities (which doesn't exist)
yet there is Player#rayTraceBlocks
PR
because spigot
wdym?
also it'd make sense to have it in World (so that the params can be Location :)) and i dont think they'd want extra methods in Player
what
i dont think they'd accept PRs that just adds a couple methods that just calls another method in another class
dkim. look at block iterator maybe?
block iterator?
yeah. its a class. in spigot
i mean he can get away with World::rayTraceEntities lol
hm
i have to be looking exactly at the player's head
or else it doesn't work
🤔
or if im nearby then it doesn't work at all
ill show video
ok now how about you show some code
actually don't
you're using the player location as source
instead of the eye location
oh-
that's why you need to look upwards a bit
Emily too smart for us
cool
yes. very
its uh
not working anymore
at all
🥲
player.world.rayTraceEntities(player.eyeLocation, player.eyeLocation.direction, 50.0) { entity ->
entity.type == EntityType.PLAYER
}?.hitEntity?.uniqueId == other.uniqueId
java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.expansion.PlaceholderExpansion.getPlaceholderAPI()" is null
any help?
interface dkim19376 {
L e = new L();
}
dkim19376.e = new Yeet();
how could I forget
ah
well
static and final in interfaces is useless
So I was doing it right without knowing
How can I get a block
Location
Like sau I want it only when they right click a certain lever can I do that with the location
Seeing if the right click matches the
Coords I put
If so how do I get the block they right click location
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
playerinteractevent
I mean like I try Block block1 = event.getclickedblock()
But it wont work bc I don’t have the import
And it wont out one in for it
Put one
uh are you doing an event handler for that?
Wdym no block import?
Like the class for it or whatever tf it’s called
Yes
It’s under my event handler
Is your event handler taking PlayerInteractEvent?
are you doing event.getClickedBlock()?
Yes
Block raidtwleporter =
Then that yes
That doesn’t seem to be the issue
The Block raid teleported is
What version are you using?
Oh well that might be why lmao
So how do I do it on 1.8.9
I just wanna get the block they click
See if it matches with coords of a diff block
Bc I want it so when they flip a lever at certai bc coords
It does something
I have it all down besides the certain coords
Just use interact event or smth else
Does someone know how to reobfuscate remapped-mojang version 1.18 on Gradle?
Any idea how to use regex with nginx redirects? rewrite ^/vote/1-(\w{3,16})$ https://minecraft-mp.com/server/271241/vote/?username=$1 permanent; This doesn't work 😦
yo soo i was working on "mc but tnt spawns on u when u touch grass"
i did the following code : https://pastebin.com/R7uJpsA5
it seems the task scheduler dosent wanna slow down the tnt spawning but instead speed it up ;-;
any suggestions on how can i fix this ?
^^the pastebin link contains only the event listener class
A member of staff has requested I move your pastebin.com paste to our paste.helpch.at!
uhm yea im just one messy coder ;-;
thought i'll clean things up after making things work yk
wait. you know that your code listens to whenever a player moves and starts spawning a tnt every 10 seconds?
yes thats what im going for
**moves in grass blocks
I'm confused. why are you making a new task every time a player moves tho?
you understand that if a player moves 5 times it will start 5 tasks right? which will all run at the same time
you should instead maybe have just one task running and not even use player move event
but i dont want the tnt to spawn when the player is for example on stone or somethin
well in your task you can check if the player is on grass or not
which you already do
like that player move event is really not necessary
ooh
i'll try that thanks 👍
btw how do i refer to all online players without using a event listener ?
@NotNull
public static Collection<? extends Player> getOnlinePlayers()```
Gets a view of all currently logged in players. This view is a reused object, making some operations like Collection.size() zero-allocation.
The collection is a view backed by the internal representation, such that, changes to the internal state of the server will be reflected immediately. However, the reuse of the returned collection (identity) is not strictly guaranteed for future or all implementations. Casting the collection, or relying on interface implementations (like Serializable or [List](https://docs.oracle.com/javase/8/docs/api/java/util/List.html "class or...
This description has been shortened as it was too long.
a view of currently online players.
thx
what is the difference between the paper api and the spigot api?
Paper is built on top of Spigot and adds new things to it, it's just non-stagnant and simply better, it adds APIs for things like tags and full json component support and it adds many, many events and methods all over the place
but you should note that if you use stuff that paper added, your plugin will probably break on spigot servers. tho that's way less than the paper servers nowadays
papi added
Go home Blitz, you're drunk again smh
Last time I checked they were closer together
Yeah they were like almost 50/50 for a while
anyone can recommend a UI library for C# that works on linux and windows? Cant seem to find one.
all I need to do with this is: let the user select a file, ask for a number from the user then display them a lot of text lol
ah found one called Eto. will look into that
Do you shade papi by any chance?
No
I'm getting beginning to learn about asynchronous methods in java now, would this be a good example of how you would do one?
public static CompletableFuture<Optional<Gang>> getGang(String string, List<Gang> gangList){
return CompletableFuture.supplyAsync(() -> {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
return getGang(UUID.fromString(string), gangList);
});
}
Thread sleep 🙅♂️
Do you have a good resource for learning more about asynchronous programming?
What could cause custom event not work on one plugin, but work on other one?
Would need more context
Plugin 1:
Main:
getProxy().getPluginManager().registerListener(this, new PrePlayerLogin(this));
Listener:
@EventHandler
public void onNotRegisteredEvent(NotRegisteredEvent event) {
event.setCancelled(true);
System.out.println("1");
}
this event listener is just not working
if i replace NotRegisteredEvent with any other event it works
BUT...
Plugin 2:
Main:
getProxy().getPluginManager().registerListener(this, new Listener(this));
Listener:
@EventHandler
public void onNotRegistered(final NotRegisteredEvent event) {
this.plugin.getLogger().info("ran notregisteredEvent");
}
this works
plugins were made by different people btw
??
I don't think you do
or i am completely wrong
but both plugins are 1:1 but one works, other doesn't
that NotRegisteredEvent is from FastLogin, a custom event was made in it
hmm
also, if it helps, i'm on Java 17, Bungee 1.18
Oh i've not worked with bungee before
👀
Block raidteleporter = event.getClickedBlock();
How would I resolve this
Incompatible types. Found: 'org.bukkit.block.Block', required: 'net.minecraft.server.v1_8_R3.Block'
You’ve imported the NMS version
will this work for checking if a block is a crop (i.e, sugar cane, wheat etc etc)
if(e.getBlock() instanceof Crops){
}
why would you do that?
use jitpack with maven/gradle
Probably better to ping SecretX for help with it since it's new ;p
@robust flower how do I build your framework because it will not work for me...
How to include a date in discord.js (embed) so it looks correctly for each user reading it, simply the object toString() or how?
can you run maven in Intellij?
Yes
@broken elbow Jitpack is for publishing
jitpack 🚮
yes. for others to publish their libraries
I want to build
then clone it and run gradle build
dead chat
?
kiddin bro
what do you mean by build? you probably want to publish to your local maven library, use publishToMavenLocal task of bukkit/bukkit-kotlin
nvm I built it but Im making it into a library jar file and seeing if I can make it work
last time it said no class found
@robust flower so you see i have been getting this error everytime with a clean good build
java.lang.NoClassDefFoundError: com/github/secretx33/sccfg/Config
I didn't try to build the library and use its jar, especially since it uses various transitive dependencies, this class specifically is located on bukkit module
well, using jitpack, at least for now, it's on my plans to migrate to a server (either Maven Central or another Cloud Hosting) for the artifacts, but until I configure everything jitpack is the only easy way of using it
jitpack 🚮
lol

(or export to mavenLocal)
im just copying what emily said cus its a funny emoji
Im not sure how to build with jitpack and I dont think I can get it on windows
but why?
I already made a guide for that, just copy paste https://secretx.gitbook.io/sc-cfg/setup
its not really clear when you say copy and paste
Im to new to just know how to do this
add the library modules as dependancy
relocate the library
are you using gradle, right?
ya
where do I put this code because I made a build.gradle file and it didnt work with this
wait, what do you mean with made a build.gradle?
is your project already using gradle?
intellij has gradle
yes, but does your project already got gradle set up?
no
then you need to first convert your project to either gradle or maven before adding my library
hmm, there's a million guides on how to convert a project, but the easiest way is to (download the minecraft plugin for intellij if you don't have it already), create a new project using gradle/maven, then move the classes from your old project folder to the new project folder
its done I have a gradle project now
ok this makes more sense
I can do it from here I think
ok, great 🙂
Someone? 
google seach for "nodejs include user time"
you should find something that you can use in your embed from javascript utils or something
@robust flower this 'com.github.secretx33.sc-cfg:bukkit:master-SNAPSHOT' does not exist
Could not find com.github.secretx33.sc-cfg:bukkit:master-SNAPSHOT
I can get it working but just thought Id let you know
nvm it still doesnt exist
Could not find com.github.secretx33.sc-cfg:bukkit:master.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/github/secretx33/sc-cfg/bukkit/master/bukkit-master.pom
Could not find com.github.secretx33.sc-cfg:bukkit:master-SNAPSHOT.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/github/secretx33/sc-cfg/bukkit/master-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/com/github/secretx33/sc-cfg/bukkit/master-SNAPSHOT/bukkit-master-SNAPSHOT.pom
I have this code that randomly generates blobs of blocks around the world on the top layer in a specific pattern: (JsonResourceNode class) https://www.toptal.com/developers/hastebin/cicowukumi.kotlin
I then have this method to trigger those ones: https://www.toptal.com/developers/hastebin/gexuxecohi.kotlin
And then this code to randomly generate the Location: https://www.toptal.com/developers/hastebin/vehixadeta.java
Here is my issue: When all the blocks are being placed they are offset by +1 on the Y axis and they appear "floating" https://imgur.com/a/99ZEL9U
Now, there is one block im placing/checking at the end of the createNode which is the block that is on top in the image above, when i remove that block on top, they work perfectly and generate like this: https://imgur.com/a/Y3evAre
How come when i add the last block on top, all the blocks get shifted up one block on the Y axis?
Fixed it, i needed to call clone on my Location instance from RustLocation
you are missing jitpack repository
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
Block raidteleporter = event.getClickedBlock();
final org.bukkit.Location raidteleporter1 = new Location(Bukkit.getWorld("world"), 22, 78, -178);
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
player.sendMessage("HI1");
if(raidteleporter.equals(raidteleporter1))
player.sendMessage("HI2");
if (player.getItemInHand().getType() == Material.IRON_INGOT) {
if(event.getClickedBlock().getType() == Material.PRISMARINE) {
player.sendMessage(ChatColor.BLUE + "Guardian Of The Sea Messenger> " + ChatColor.YELLOW + "You have summoned the Guardian Of The Sea \n" + ChatColor.GRAY + "Be wise on the decisions you make further on.");
final org.bukkit.Location location = new Location(Bukkit.getWorld("world"), 10, 10, 10);
player.teleport(location);
}
}
if (!raidteleporter.equals(raidteleporter1));
{
player.sendMessage("f");
}
if (event.getClickedBlock().getType() != Material.PRISMARINE) {
return;
}
else if (player.getItemInHand().getType() != Material.IRON_INGOT) {
player.sendMessage(ChatColor.BLUE + "Guardian Of The Sea Messenger> " + ChatColor.YELLOW + "You don't have the right materials to summon the Guardian of The Sea");
}
}
}
}```
Even at the right coords of raidteleporter1 it doesnt do it it always sends "f" bc its not the right or atleast it says its not
@robust flower
Could not resolve all files for configuration ':compileClasspath'.
Could not find com.github.secretx33.sc-cfg:bukkit:master-SNAPSHOT.
Searched in the following locations:
- https://jitpack.io/com/github/secretx33/sc-cfg/bukkit/master-SNAPSHOT/maven-metadata.xml
- https://jitpack.io/com/github/secretx33/sc-cfg/bukkit/master-SNAPSHOT/bukkit-master-SNAPSHOT.pom
Anyone?
check your raid teleporter you set one to block xyz and other to get block click
and said if they are equals
@warm steppe
I know nothing about bungee nvm
@robust flower
https://pasteboard.co/v3agfwCT1fHG.png
No read access
also if someone is thinking about that setCancelled method usage, it does not work without it.
What does this even mean
if i remove that method it also does not work
Heya guys. So I have this one function called "get_near_and_apply", which take as parameters integers x, y, z, a potion name (in string), and an int level parameter. The function uses x, y, z as maximum distance in each axis for finding nearby entities. Then, the nearby entities get the Potion passed as a parameters, with a level associated to it.
The problem is: I want to take the input of the potion as a String, and then use It to get a PotionEffect object
how can I do that without a lot of ifs
or a hashmap that takes each possible string and converts it to a PottionEffect object?
why do you want to covert PotionEffect to string
I want to make It easy for later use. Like, instead of always using "new PottionEffect(PottionEffectType..."
I can just say
take "regeneration" with level 2
not that important, but I like to make things to make my life easier on the future
I see
oh
isn't the other way around, though?
I will be passing a string and converting It to a java object
Or am I misunderstanding something?
Im trying to understand what you doing
Ok, I guess a example will make things more clear
sorry, bad example. I meant nearby entities
suppose you want to give nearby entities regen II
I want to do
ok
get_near_and_apply(10, 5, 10, "regeneration", 2)
you would make a forloop getting all the entities
yeah, this part I can do
the problem is getting the potion effect "regeneration", using the string "regeneration"
then you want to take that string and add it to the potion effect object?
yeah, I want to apply the effect to the nearby entities
not really add it. Just apply
of course I can just do "New PottionEffect..."
ok one min I will make a piece of code as example since its not easy to explain
but I want to make it in a more legible way
Oh, of course! I really appreciate your help, by the way
np hope I can make it properly x3
please stop with the underscores in function names
idk why i said brackets, brain no work
@plucky helm do you want a list or a forloop
I find It more legible than camel case
List is the best way to use
Yeah, It can be a list, no prob
because you can index all

no stick to java conventions
there's a reason intellij bugs the fuck out if you try and do an underscore when getting a function, cause its an ungodly thing to do
java conventinos is lowerCamelCase variables, lowercase packages, UpperCamelCase classes and underscores are always avoided
ah, I see
they're tolerable on variable names but even then its iffy
Thanks
not always?
constants are named like this: UPPER_CASE
but in rest what ori said applies
yeah i said that and i was like
well yeah they're used sometimes
but i still find them weird
@plucky helm I cant seem to find the giving potionb effects to mobs
but I can give you the code and you can figure it out
Don't worry about It. I think in the end I'll have to use a hashmap, regardless
to take the string as input and return a PotionEffectType object
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
oh, that is clever, I like It
thanks
:)
I tried to keep it simple
not to boast but I like readable code in my code
you dont need Player though I forgot to take that out
@plucky helm
I don't see how you can do that without "player"
since you have to use the distance from the entity to the player
d;spigot world#getnearbyentities
Maybe I'm misunderstanding something
@NotNull
Collection<Entity> getNearbyEntities(@NotNull Location location, double x, double y, double z, @Nullable Predicate filter)```
Returns a list of entities within a bounding box centered around a Location.
This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.
location - The center of the bounding box
x - 1/2 the size of the box along x axis
y - 1/2 the size of the box along y axis
z - 1/2 the size of the box along z axis
filter - only entities that fulfill this predicate are considered, or null to consider all entities
the collection of entities near location. This will always be a non-null collection.
sorry, I didn't turn my notifications on
Yeah, that makes sense
@plucky helm I think this will work
entityList.add(e);
}
}```
why not just get the entity within the distance you want?
so you don't need to compare the distance
I guess we could do that to optimize it more
Thanks, I'll try It
but I think you should still compare because if you set it to a static disctance it will only give the effect at that distance
and when its close the potion effect will ware off
depending on how far they want the effect to be applied
its its something like 7 blocks then the entity will be way within range and the effect will not stay on
.
@plucky helm
I'm not sure if I got it, but I'll try to understand now
and I think gabys will work better
loc.getWorld().getNearbyEntities(loc, 3.5, 3.5, 3.5) to create a 7x7x7 cube then just iterate though the collection
yes much better
now I'm in the part of adding the given potion effect to the entity
I found that "LivingEntity" has this method
for (Entity entity : nearby_entities) {
LivingEntity living_entity = (LivingEntity) entity;
living_entity.addPotionEffect(potion);
player.sendMessage(living_entity.getName());
}
I tried iterating in the list
I think It's doing all right
however, It's not actually doing anything to the entity
It's getting It's name, though
my command (it starts a bukkit task from another class)
https://pastebin.com/r2iXyCbK (the class code)
the problem i am facing is the second time i run the command in game it creates a second task... i want it to replace the original task with the new one when i run the command
any suggestions ?
@thick kestrel could you paste your entire build.gradle?
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
So, I'm trying to iterate through the entities of a list and adding potionEffects to these entities
for (Entity entity : nearby_entities) {
LivingEntity living_entity = (LivingEntity) entity;
living_entity.addPotionEffect(potion);
player.sendMessage(living_entity.getName());
}
I can see the entity is being reached, because It's sending me the message, in "player.sendMessage(living_entity.getName())"
but the entity doesn't receive the effects
maybe mobs can't have potion Effects directly given to them?
I'm not sure
ya I couldnt find addpotioneffect on a list either
I tried to make It work by casting It to livingEntity
since livingEntity has this method
@plucky helm just try this
LivingEntity livingEntity;
oh your getting the entity
nvm
I'm already doing It with "LivingEntity living_entity = (LivingEntity) entity", no?
thats ok
@robust flower are you sure what you put on the readme is right? Jitpack is a bitch and doesn't really care about your build.gradle, the dependency it gives is com.github.SecretX33:sc-cfg:Tag where Tag is the version, being a commit, branch, or release
@plucky helm the only thing I can think of why this is not working is the potion effect is not valid
weird
PotionEffectType is "PotionEffectType.SPEED"
Which I am pretty sure Its valid
weird
I searched for it and apparently I'm not the only one confused by this
maybe It's a bug?
Don't you need to add a strength and duration to the potion?
yeah
I'm already doing It
oh
I'm using this hashmap to make the convertion from potion name to potion type:
Map<String, PotionEffectType> spellName_to_spellObject = new HashMap<String, PotionEffectType>() {{
put("regeneration", PotionEffectType.REGENERATION);
put("absorption", PotionEffectType.ABSORPTION);
put("speed", PotionEffectType.SPEED);
}};
d;spigot LivingEntity#addPotionEffect
@Deprecated
boolean addPotionEffect(@NotNull PotionEffect effect, boolean force)```
Adds the given PotionEffect to the living entity.
Only one potion effect can be present for a given PotionEffectType.
no need to force since multiple effects of the same type are now supported.
effect - PotionEffect to be added
force - whether conflicting effects should be removed
whether the effect could be added
Try setting the force, on the example you sent there isn't
Idk if that'd be it though, just for testing
are you grabbing the Map properly?
yeah. I think I'll just send the function
public void get_nearby_and_apply(Player player, int x, int y, int z, String spell, int duration, int level) {
List<Entity> nearby_entities = player.getNearbyEntities(x, y, z);
PotionEffectType spell_object = spellName_to_spellObject.get(spell);
level = Math.max(1, level);
PotionEffect potion = new PotionEffect(spell_object, duration, level-1);
for (Entity entity : nearby_entities) {
LivingEntity living_entity = (LivingEntity) entity;
living_entity.addPotionEffect(potion);
player.sendMessage(living_entity.getName());
}
}
@thick kestrel I'm stupid, I'm so sorry lol, you just have to replace "master" by "main"
It's in this format because it's a multi module gradle, but yeah there's something wrong there, and it is the "master" because my main branch is called only "main"
thanks a bunch it built
what a stupid typo :/
I'll leave now. If I find out what is wrong I'll come back to say It
thanks guys
:))
Now upload it to central 
?
We're generating a profile for this user, try again in a minute.
you've sent over 200 messages in here and barry hasn't given you a role yet, it's weird
thx x3
I already bought a VPS on OVH, they are processing the payment or something, I'll configure it, then buy some dns address to put it (after I figure out how to set up reposilite there)
did I get a role yet?
x3 thx
yo soo i have a command that starts a bukkit task
public class tnttoggler implements CommandExecutor { @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { BukkitTask cooltasks = new tntspawntask(main.getPlugin()).runTaskTimer(main.getPlugin(), configfile.getCheckTime(), configfile.getSpawnTime()); return true; } }
i want to pass the name of the commandSender() to the bukkit task... how should i do that ?
2015
never been hacked
Oh, i was talking about central, it's free
@torn burrow you can access the name via CommandSender#getName
how do i pass that to the bukkit task ? (its in a differrent class)
add an additional parameter to the constructor for "tntspawntask" that accepts a string (the username)
then you can simply pass in the username with the rest of the arguments
That is me poking my own repository after I configure it
yeah yeah, but I always wanted to have my own repo
generally a better idea to publish to central to ensure code doesn't break in the future
the issue with central for me is their policy of wanting only code that depends entirely on libraries that are already there, and even if that is not enforced now, it might be in the future (plus my lib uses jitpack for one specific dependency and I'm sure maven central does not like jitpack kek)
I'm sure maven central does not like jitpack kek
no one likes jitpack
question will my plugin not run with java source folder
what do you mean by that
sophia you need java classes for your plugin to run
the plugin.yml points to a class, so if there's no classes to point to, it cannot run
I know, soon I won't need jitpack anymore
show me the directory structure of your plugin
how are you building the plugin?
artifact
also that main.iml file can be deleted
you need to build your plugin via gradle
that's what it's there for
oh ok
click the gradle button on the right side of intellij
gradle assemble?
does it go to where the output folder of the artifact is?
shadowJar is the one you're looking for since you have libs
the jar will be in build/libs once you run shadowJar
thanks
ah this error again @robust flower
java.lang.NoClassDefFoundError: com/github/secretx33/sccfg/Config
what jar are you using from build/libs?
snapshot is the only one there
i couldnt do that it said
"Record header declared for non-record"
ig a class extending to BukkitTask cant have a argument to it ?
delete the build folder and run the shadowJar task
ok
now that looks like something went wrong with your shadowJar task
also paste your build.gradle
=paste
idek how to get the link anymore
slash commands suck
Use ?paste, it still works
aight
so do I use shadowjar to build from now on?
yes
ok thanks
yes, sc-cfg can serialize any kind of data struct that gson can
@robust flower [09:28:10] [Server thread/WARN]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
but then
config exception
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
what java version are you using?
why should I use an interface for a class?
java 69 of course
nice
Implementing an interface is like a contract that says that your class has to implement these methods or whatever
That way you can do some nice polymorphism stuff
@guys
same
I need developer
nitro classic
For My Server
for your server?
no, for my server
oh for your server
For Mine
for yours?
Lmao
ah so it must be yours
what? No
then whos?
I just said it's not yours
tell you what
give me all the nitros you have
and I will not do anything in return
but I will give them away in #giveaways-old
Hey guys! If we could move this discussion to #off-topic, that would be great!
Hello dear helpers ^^
I'm currently making a permissions plugin (like groupmanager, pex, luckperms,etc...) and I also don't know how to do something...
I did well for setting player's rank + player's name in chat and in tablist
But I don't know how to change the player's nametag... (without an API)
I know there is something like packets but idk xD
I'm using spigot 1.8
This is my code right now:
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/ to upload images/screenshots.
Suppose I had a list of many items in Minecraft. For each item there is a probability in percent to get this item in the distribution. How do I use this probability? There is, of course, the method of throwing the same item into the list several times in order to increase the chance. But is there a way to determine the chances by percentage?
you may use: java public boolean getChance(int minimalChance) { Random random = new Random(); return random.nextInt(99) + 1 >= minimalChance; }
then getChance(percentage);
for instance: getChance(50); will have 50% of chance to return true
If I have an ItemStack that is a player head, how would I go about placing a block from that ItemStack ??
I think (didn't try so xD) you should not use itemstack but Block
Blocks.HEAD
or something like that
No I know, but I'm using HeadDatabase's API to retrieve the custom head, which gives me an ItemStack
hdb api has a method to set the texture to a block
It does??
Oh shoot you're right, I just found it
but thanks for finding it for me as well
I was not aware of this, thnx!!
np
It gives me this error though
at me.arcaniax.hdb.util.HeadUtil.setBlockProfile(HeadUtil.java:210) ~[HeadDatabase.jar:?]
at me.arcaniax.hdb.api.HeadDatabaseAPI.setBlockSkin(HeadDatabaseAPI.java:309) ~[HeadDatabase.jar:?]```
Know what that could be?
Using this code:
currentBlock.setType(Material.PLAYER_HEAD);
hdbAPI.setBlockSkin(currentBlock, "702");```
@robust flower 16
sorry for late reply at work
please ping me when you get back to me
looks like hdbAPI is null
or something like that
Nope..
I read a bug on their issue tracker that the function always returns false - Is there any other way to set a player_head block's skin from an ItemStack??
that does not look like something returning false lmao
that's a null pointer exception
I don't know what it would bet though,
hdbApi.getItemHead("702"); works just fine
So must be the function that it's wrong with
@thick kestrel what mc version are you using?
@robust flower 1.17.1
Compiled with Java 16, Server runs Java 16, Server Runs 1.17.1
I'll test the library using those specifications later on, I'm busy rn, but it should work just fine
@plucky helm did you get your potion effects working?
ok was just wondering
use gradle
