#help-development
1 messages ยท Page 2233 of 1
did this not work?
copy paste a working pom from someone
well put it inside
<build>
<plugins>
//here
</plugins>
</build>
just needs to be in the plugins section
yes
k
Also sorry for chaging topic but the replace for Player#getItemInHand() is Player#getItemInUse() right?
isnt it just getiteminmainhand
Player#getInventory#getItemInMainHand iirc
getItemInUse is the item that's currently being used (pickaxe, eating food, ...). it's null when no item is used
huh i was right for once
offHand is the left hand, not the right
im aware
wait
what if you switch main and off hand in settings
is it bound to left right or to the actual main and off hand
it's MAIN hand not right hand
He?
the main hand is always the selected hotbar slot, no matter whether that's your left or right hand
ah i see
Ahh ok
is a system.gc call ever necessary?
no
so.. setup the path correctly
what does that?
garbage collect
ask java nicely to garbage collect
its basically like asking the garbage collector "please for the dearest sake of love of my god, clean up some memory for me"
java does whatever it wants
you dont have to
pretty sure paper flags or paper itself actually stops you from using that
and funny thing, System.gc() is often useless in spigot/paper server envs
Just call System.gc() at the end of every method
why not use a runnable every tick
the method just says 'please garbage collect' it doesnt actually force it
Not enough. I want it in EVERY method
that can be improved to every ms
well it queues it
getters, setters. everything
so like it will run pretty soon ish
see ya
@Override
public void onEnable() {
new Thread(() -> {
while (true)
System.gc();
}).start();
}
maybe a sys gc call after every bytecode instruction :3
The reminds me of my contribution to the terrible-plugin
I remember lol
what's the terrible-plugin
it's a great plugin
github?
check out my awesome motd package
import java
.lang
.reflect
.Field;
forgot, Thread::setPriority with MAX_PRIORITY
but ye
lol
@Setter
public static @NonNls @Nullable @NotNull Main instance;
what the frick is this
public enum Logic {
;
public static final Boolean TRUE = !!!false;
public static final Boolean UNTRUE = Double.NaN == Double.NaN;
}
here's one of my awesome contributions
oh thats also fro mme
lmfao
i love how its properly documented too
thats funny
lol
๐
for(@NotNull int i = 0; i < 20; i++){
System.out.println("Oops! Looks like something's gone wrong here!");
new RuntimeException("I'm an error! Woohoo!").printStackTrace();
}

love the random kotlin sql manager
lmao
dont dare to instantiate me
but i dont find the correct repo
this whole plugin is just one big meme
There was a time where me and my buddy went on spigot, decompiled the newest contributions. We literally couldnt sit straight.
/**
* simple method to get instance of plugin
* @return plugin (mostly)
* @throws Throwable when it doesnt work
* @since today
*/
public static Optional<Plugin> getInstance() throws Throwable {
Optional<Plugin> emptyOptional = Optional.empty();
SimplePluginManager plugMan = (SimplePluginManager) Bukkit.getPluginManager();
Field f = org.bukkit.plugin.SimplePluginManager.class.getDeclaredField("plugins");
f.setAccessible(!Logic.UNTRUE);
List<Plugin> plugins = (List<Plugin>) f.get(plugMan);
for (Plugin plug : plugins) {
if (plug.getClass().getCanonicalName().equalsIgnoreCase(String.valueOf("dev.jaims.terribleplugin.Main"))) {
instance = (Main) plug;
return Optional.of(plug);
}
}
return emptyOptional;
}
return plugin (mostly)

OuchieListener https://github.com/AcmeProject/WildernessTp/blob/master/src/main/java/net/poweredbyhate/wildtp/OuchieListener.java
static void plsSaveDisDood(final Player player) {
UUID id = player.getUniqueId();
TooCool2Teleport.microwave(player);
dr0pp3dPuhlayars.put(id, Bukkit.getScheduler().scheduleSyncDelayedTask(WildTP.instace, new Runnable() {
@Override
public void run() {
dr0pp3dPuhlayars.remove(id);
}
}, 400L));
}
what are those class names
"high quality code"
hehe i guess he was drunk
lolo is obviously referring to two locations
at least he was asking for 1.13 and not 1.8
ah yes, the glory hole boolean
i feel like its actually harder for me to come up with such ridiculous code rather than (mostly) good code
yes exactly lmao
i also love
TooCool2Teleport.microwave(player)
Lmao
F
Here are the rest:
https://www.spigotmc.org/threads/funny-plugin-reviews.392142/
ugh
wheres that microwave coming from
magnificent
Hairy
server still starting up
get the location, set the yaw to yaw+180 (or -180), then teleport the player there
Multiply his direction by -1 and set it as his new direction

@tender shard * CHanged misleading constant name "FALSE" to "UNTRUE" lmfao im dead

XD. The eternal garbage collecion
it did start laoding the db tho
basically me not launching the server with a terminal
so it does get stuff done
lol
gn
sleep tight
i hope you dream of slimy snails
wut
i said: i hope you dream of slimy snails
gonna leave the server running and see how long it takes to enable
bad boy
i'm good
mh bye
what a perv
Bet its about to lift off
private boolean isHigherNumberThanTheFirstOne(Integer uno, Integer dos){
int number = -1;
for(int i = 0; i < Integer.MAX_VALUE;i++){
if (i == dos){
number = i;
}
}
return number > uno;
}
do u guys think this is a good method to find out if 1 number is higher than the other?
yes
Peak performance
aight should prolly start using this then
omg its so hot
rather than >
I think you need an AbstractIsHigherNumberThanTheFirstOneInstanceBakeryFactoryGenerator too
lmfao
@tender shard did u rlly change every single true & false to ur enum thingy btw? ๐
I think so lol
are there any plugins that kill the player after they pass a border? I really dont wanna code that lol
the worldborder?
doesn't the worldborder do that automatically?
nope, an imaginary border I set
Should it be a circle or a square?
square
i wanna log some stuff from my plugin to a database, how should i do it. All logs of all types in one table or every type of log in diff table
and circle would be helpful down the line
dont wanna have too many tables tho
Well... this can be done in a single class
use nosql if you can Id say
since the data isnt particularly structured anyway
i'm already using sql
thats a shame
I know but I heard someone made something like that already, I couldn't google it properly so I didn't find it
should i just throw strings, uuid and a timestamp in?
| ID | Fat data String |
There is a plugin named worldborder which throws a player back
and ig i should create a set of logs to cache them, then every 5 mins, throw them into the table?
thats one way to do it
dont wanna have to make a db request every time
I mean Id just have a thread pool and send the logs to the db as soon as possible and let the pool handle throughput
hm alright
What version?
i'd use a concurrent collection of some sort for that?
I might just do it myself for a static block like maybe glass, what's the proper method to know if a player hit a block?
for what?
let me open IntelliJ
i've never done something like that before
ExecutorService pool = new ForkJoinPool(
1 + Runtime.getRuntime().availableProcessors() * 2,
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
(t, e) -> e.printStackTrace(),
true //FIFO
);
//THEN
CompletableFuture.runAsync(() -> {
database.pushLog(log);
},executor);
One moment
ah ok
the parellelism is the throughput to some extent
but Id keep it 1 + 2n where n is the amount of available processors
why that num?
well first of all the lowest available processors will go to is 1, so the lowest would be 2
in which you'd essentially have 2 workers at most
isnt that 1+2=3?
this allows for some distribution, even among a single processor
oh wait yes
ugh
remove the 1
lol
mathfs!
why is that better than a single thread tho?*
How i do set a custom texture on tabs?
smth like that? cpp Block b = p.getWorld().getBlockAt(p.getLocation().subtract(0,1,0)); if(!b.getType()."Glass block")){ "player kill method"); }
but for all directions?
For example a head
well minion I think we talked about this before
."Glass Block"
what tf is that
Wft
lmao it's psuedo code
but concurrency is measured in throughput
CHILL IT'S PSUEDO CODE
?learn-java
momment
parallelism is speed?
?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.
yeah but what is that supposed to mean anyway
should i use an executorservice for all my database stuff then?
I want the player to die once they hit a block, so I can make a border of it
would that work?
ok will switch over
this is due to that they're platform threads
so ye
what did u use
/use as of now
what u think?
Idk
bukkitrunnables
runTaskAsync?
ye
thats still powered by a thread pool
a cached thread pool, which is dangerous because it by default doesnt know when to dynamically at runtime stop the amount of threads it should create
so it could in theory scale to a ludicrous amount of threads
so i could switch or is it good enf?
yeah probably wanna switch
no worries
but just to clarify, the parallelism is the amount of active workers the pool will try to have, more threads might be created... assuming you log stuff frequently, then having some workers active passively might be to your benefit, with this being said the thread pool might create more threads assuming some are being blocked
on interact events, it doubles because of both hands. How do i make the offhand when clicking do nothing?
Check the hand type when the event is fired
getHand == whatever
?jd
Like you add any other dependency to your pom
Only MySQL
huh
and set a scope
<scope>compile</scope>
you also need the maven-shade-plugin
https://blog.jeff-media.com/common-maven-questions/ second headline
How do i cancel combat in general?
hey guys, any idea why these methods are not working?```cpp
@EventHandler
private void onJoin(PlayerJoinEvent e){
e.getPlayer().setAllowFlight(true);
}
@EventHandler
private void onDeath(PlayerDeathEvent e){
e.getEntity().setAllowFlight(true);
}
}```
The problem is that intellij > than everything
I ask because i also need to disable the mobs damage to player and backwards. Does it affect or not?
the whole class is registered in main
Please send your full code
?paste
yes
Because im doing diff Flags type, the Combat one only disable damage between players, the Damage one will only disable fall damage (trying to figure how to do it) and the last Mobs one which allow kiling mobs
Thanks i wil ltake a look
Give me some minutes
Hopefully quick question, how does the Bukkit.getScheduler() work? Everything in my command is working, but specifically the Bukkit.getScheduler() doesn't work.
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
msg.send(sender, "&cCommand Worked!");
Bukkit.getScheduler().runTaskLater(new main(), () -> {
msg.send(sender, "Waited 5 Seconds");
}, 100);
}
return true;
}
}```
dont create a new Main()
You should use dependency injection
how do i do that?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
There is an example
alright, thanks, ill give it a look
Allright have a good day
I'm sorry I don't understand
everything in my code works but these 2 methods
isn't that what this getServer().getPluginManager().registerEvents(new Misc(this), this); does?
agree i dont know what it does
and I'm registering the whole class
these methods are part of the class
the whole class works fine BUT those 2 methods
first of all main plugin class should be initialized only 1 time
I don't see how that's a register error
add some System.out.println() and see if it prints sth when a player joins
do you have any other plugins installed that might set setALlowFLight to false again?
that sets fly to false when players do not have the perms
how do I give everyone the perms then?
try to run it on MONITOR priority
Lmao why monitor debug an severe when cancelling?
what?
I will just do a runTaskLater after 1 tick so it bypasses essintials initial setAllowFlight = flase
i'd rather try to use MONITOR priority first
a bit more
I have no idea what that is, I know about priorities I just don't know about this one
4 ticks?
@EventHandler(priority = EventPriority.MONITOR)
public void onJoin(PlayerJoinEvent event) { // ...
Because sometime can take a big longer
yes I know what that is, just what the "MONITOR" does
yeah lag n stuff
MONITOR means your listener gets the event last
Essentials probably runs on HIGHEST or so. Monitor runs after highest
oooh ok sounds like it would solve it
i was cancelling event on monitor and i get a severe exception that why i dont use it
you must not cancel events on monitor
why wouldn't I use LOWEST then?
No modifications to the event should be made under this priority
because LOWEST runs first
LOWEST priority runs first?
if you allow flight on LOWEST and Essentials disables it on HIGHEST then it won't work lol
?paste
yes
I can help you
LOWEST -> LOW -> NORMAL - HIGH -> HIGHEST -> MONITOR
I thought it was the other way around
me too :fun:
where are u reading?
HIGHEST means "it has the final say in what happens"
interesting, good to know
so a listener on HIGHEST can override changes made on lower priorities
I'll try that, thx
declaration: package: org.bukkit.event, enum: EventPriority
what version of the jdbc are you using?
Try using the last mysql-connector from Maven
How are you connecting?
Using JDBC or HikaryCP?
still not working so I will try a scheduler
Send which driver are u using
Like the dependency from pom
Allright it correct
I use that one
Last option your mysql server has an old version
Because the client its the lastest version
I dont know the command for checking the version
dataSource = new HikariDataSource();
dataSource.setJdbcUrl("jdbc:mysql://" + host + ":" + port + "/" + database);
dataSource.setUsername(username);
dataSource.setPassword(password);
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setConnectionTestQuery("SELECT 1");
try use hikari
also try connecting to it with ur phone
ik there are some phone sql stuff
fret not. Im just doing the last changes for this.
don't use it. it's deprecated
HikariDataSource
what?
This will returns if the 2 entities are not player and if one of them is not a player right?
Idk why im annoyed
Which api?
My plugins one?
Allright thanks
I dont know why i was dudeing which operator to use
Here i made a KillBorder plugin.
https://github.com/Flo0/KillBorder
You can either clone it and do some changes to it or you can go to releases and download the compiled jar.
what's that for?
What do you mean?
you got a typo in your package name
๐คท meh
what's the plugin for?
This is what you told us you needed. A plugin where you can define a virtual border. And everyone who leaves it, dies.
working on a plugin that need chunck to be refreshed but I see that getWorld().refreshChunk is deprecated would there be a way to not use it?
Are you the custom grass guy?
nope working on the reboot of voxel
voxelsniper?
yea
lol "are you the custom grass guy?" that's probably how 12 year olds talk to shady people at the train station when they try to buy weed for the first time ๐
https://github.com/KevinDaGame/VoxelSniper rn making somting for them
Voxelsniper already has a well maintained fork.
Last update was 6 days ago.
Thank you but I already made it like that: ```cpp
@EventHandler
private void hitGlass(PlayerMoveEvent e){
Player p = e.getPlayer();
p.setAllowFlight(true);
Block a = p.getWorld().getBlockAt(p.getLocation().subtract(1,0,0));
Block b = p.getWorld().getBlockAt(p.getLocation().subtract(-1,0,0));
Block c = p.getWorld().getBlockAt(p.getLocation().subtract(0,0,1));
Block d = p.getWorld().getBlockAt(p.getLocation().subtract(0,0,-1));
Block ee = p.getWorld().getBlockAt(p.getLocation().subtract(0,-1,0));
Block f = p.getWorld().getBlockAt(p.getLocation().subtract(0,1,0));
if(a.getType() == Material.GLASS || b.getType() == Material.GLASS || c.getType() == Material.GLASS || d.getType() == Material.GLASS ||ee.getType() == Material.GLASS ||f.getType() == Material.GLASS){
p.setHealth(0);
}
}```
Block a,b,c,d,ee,f??
well ig there'S 2 fork
why?
event is called e lol
lazy fix :/
Shity java
ouch...
sorry lol, I really appreciate it tho
I really just googled how to make a bomb spigot I should expect FBI at my door at any second now
it's not
Okay im dumb
You can still use the method refreshChunk. It just might not be 100% reliable for all clients.
Why alex?
you return in the scope where you have player defined
Oh that why right?
yes
Allr so when im returning i can use that type of vars
Also, when im using returns true on command it allow me ? ๐ค
So its really shity the design
public static void main(Entity entity ) {
if(entity instanceof Player player) {
// Here you can use player
}
// Here you cannot
}
Hmn i dont think
Look this
if(!(entity instanceof Player player)) {
// Here you can't use it either because it's not a player
}
that makes absolutely no sense
hahaha that why
He no?
Yeah if not a player return
What wrong?
yeah
I cannot understand
Verano is a different breed. Sometimes it seems like he gets complicated topics and
other times he pumps out stuff like this or "i never used a list at all"
yeah he's smoking too much weed
Oh
maybe
Now that my gf moved to another city i cannot stop
She was helping a lot
I feel a sense of loss
hahah that day i drunked + smoked
I was on my last
yeah LMFAO
If u not it, it's scope is outside the if
yesterday was also funny
With me you can write a book
verano wanted to talk about "grilled chicken" but he kept saying "kitchen roosted" instead of "grilled chicken" haha
yeah some "fan man" kind of book lol
btw verano did the police arrive after you called them?
i think it was yesterday? or the day before
๐
you want to detect when it becomes solid?
entitytransformblockevent or something
EntityChangeBlockEvent should be called when the anvil hits the ground
when you spawn the entity, save it's uuid or the entity object in a list or whatever. and in the event, check if your list contains it
or add metadata or a pdc tag to the entity
Set<UUID> is honestly better at that point lol. No reason to write to the PDC
You're then going through serialization and deserialization when you set/get it
set is better
HashSet will be faster, yeah
the entity of course
Hallo
why not ๐ค
they take about the same amount of storage
git uses csv lol
why would you need that many loops
you do realize SQL has to perform querys too, right?
why did you use a crab as rust logo lol
?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.
kill the entity and cancel the event
kill the event and cancel the entity
๐
weird set of reactions but ok
u put them on it kek
i dont think i did
i can see ur name dumbass
told you not to fuck with me
ban ban ban
are you awake now?
I will do it again
breing rude to staff
I fucking swear I will
IM NOT EVEN JOKING
craft a lightning rod for next time and place it further away
Yesterday i witnessed something similar. Just like 30 times. Lightnings struck the forests around me for 15 mins straight.
PS: Go out and see if you can find some skely horses. And take a dinnerbone nametag with you.
doesn't it also power creepers?
and humans into bodies
that too
This is you
- Its not
MySQL
You can literally just dump json in it without all that schema nonsense
advantaged really depend on your application
some dbs are better in certain situations, and what not
Mongo does have a hot java lib
do you have a phone?
sure
high five! i got one too
๐
get a sql client and try to connect
see what it says
also, do you have a password set?
mysql -u user -h host -p
I'm packed and I'm holding
I'm smiling, she's living, she's golden
She lives for me, says she lives for me
Ovation, her own motivation
She comes round and she goes down on me
a song about crystal meth
127.0.0.1?
the host is the address of your sql server
if it's running on localhost then try 127.0.0.1 and localhost
SchedulerThing
myclass
Queerduler
quick question, how do you grab data from a specific player on a scoreboard? If I setup ingame a scoreboard with the player "doctor" and gave it a score, how would I grab the data from that player on that objective?
BukkitScheduler2
public <T> Optional<T> getAsync(what interface for here?) {
}
nvm what i said, there is a whole org.bukkit.scoreboard package i didnt see lol
isn't that a completablefuture at this point
hm true
I'm not entirely sure what your goal even is for that method anyways. Though 9 times out of 10, if you're working with a returnable value asynchronously, you want a CompletableFuture
yaeh i just realized
Alternatively, you can do a public void getAsync(Consumer<Optional<Object>>)
Whatever the object is
i swiched to compleatable future
Yeah. They're just cleaner overall
i doubt sql is the reason you cant connect
while I agree mongo is nice, everything has a usecase
Because is for lazy people like me
let me see the access denied message?
i saw that before
access denited for root@127.0.0.1
oh localhost
Hahah I just tell mongo use this class as model for saving, updating and deleting. So it pretty much looks like using Mongoose from Javascript
Also access denied is because the user os not configured correct
remember how u logged in before
well not logeed in
but from the consoleitself u can run sql commands?
GRANT ALL PRIVILEGES ON database.* TO 'root'@'localhost';
have u tried that^
then flush privileges
You have to join to mysql as root. And them that first command and them flush privileges;
flush privileges;
FLUSH PRIVILEGES;
Camel case
maybe remove the ''
is it possible to run a java file from a different java file? I don't want to run the class, I just want to run the whole file. is that even possible?
like another jar I assume
wait no, i do want to run another class lolol
changing question, how do you run a class, from a class. i think lol
yeah, run a class from a class
It depends on what you wanat to do
public <T> void getAsyncAcceptSync(Supplier<T> supplier, Consumer<T> toDoSync) {
CompletableFuture.supplyAsync(supplier, pool).whenComplete((t, throwable) -> {
if (throwable != null)
throwable.printStackTrace();
else
new BukkitRunnable() {
@Override
public void run() {
toDoSync.accept(t);
}
}.runTask(plugin);
});
}
is this fine?
after looking up what method means, yes, thats what im looking for lol
If you're waiting for a result, thenAccept(value -> {}). Though that won't be called if an exception is raised, so if you want to handle the exception,
.whenComplete((value, e) -> {
if (e != null) {
e.printStackTrace();
return;
}
// Operate on value
});```
I would remove that Consumer and just return the CompletableFuture so the caller can operate on it as they so choose
But all you'd have to do is thenAccept(value -> {})
public <T> CompletableFuture<T> getAsync(Supplier<T> supplier) {
return CompletableFuture.supplyAsync(supplier, pool);
}
i also have this
Oh okay
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.
ok, got it
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
and yes, probably would be beneficial lol
yeah, i will defenitly start cause it will probably help
thanks lol
Hey guys, so right now I am trying to interact with this npc. The problem is that I can only interact with it on the shadow circle - which would be the space for the standing pose. The question now, how can I interact with the whole body when it's laying?
maybe a playerinteractevent?
just check if it's the block they're laying on
kinda hacky but it'll work
so basically check if there is the location of an npc above the clicked block?
that sounds smart yep
so basically that little area you can interact with, that's a laying player's hitbox
it's not the same as a standing player's hitbox
I'd recommend putting an entity in that space like an invisible armor stand to make it interactable
wdym?
a test server?
what does that mean?
what's wrong with jdbc?
that's ur mysql db
that's not jdbc
can u connect to it frm ur console?
using mysql -u etc
well then try connecting with a program frm another pc
if ur willing to bet it's jdbc
and?
u didnt use localhost right?
rip
uninstall and start all over lol
u can just use sqlite
public SQLiteDatabase(File folder, String fileName) throws StartupException {
this.folder = folder;
this.fileName = fileName;
if (!this.folder.isDirectory())
this.folder.mkdirs();
File file = new File(this.folder, this.fileName);
try {
if (!file.exists())
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
throw new StartupException(e.getMessage());
}
}
@Override
public void setupDataSource() {
dataSource.setJdbcUrl("jdbc:sqlite:" + folder.toPath().toAbsolutePath().resolve(fileName));
dataSource.setDriverClassName("org.sqlite.JDBC");
dataSource.setConnectionTestQuery("SELECT 1");
}
a sqldatabase class
yes
public abstract class SQLDatabase {
protected final HikariDataSource dataSource;
public SQLDatabase() {
this.dataSource = new HikariDataSource();
}
public abstract void setupDataSource();
public Connection getConnection() {
try {
return this.dataSource.getConnection();
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
public boolean isConnected() {
try (Connection connection = this.getConnection()) {
return connection.isValid(2);
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}
public void close() {
if (!dataSource.isClosed())
this.dataSource.close();
}
public abstract String getType();
}
im trying to rotate an armor stand. It is a vehicle so im listening PacketPlayInSteerVehicle to rotate. The problem is that it rotates only a bit and stops
how can i fix this?:
When I use the mojang mappings, and compile using maven, which jar do I distribute? the -remapped-obf one?
Hi, how can I replace the specific message that player would get with NMS?
I'm trying to make a bounty plugin, and I want to make a gui that includes all online players heads, but I'm not sure how to define a specific players head any thought?
No the one with no weird stuff to the end
Like just name and version.jar
Thank you, didn't want to distribute the wrong one.
Test and make sure it works before u do
What is xxa?
Ah ok
You just modifying the location of the armor stand, Entity#getLocation return a copy of the location, so you need to teleport to update the location.
oh right, mb
I'm trying to make a bounty plugin, and I want to make a gui that includes all online players heads, but I'm not sure how to define a specific players head any thought?
SkullMeta
how can I cancel a horse's jump
the setCancelled method for HorseJumpEvent is deprecated
I've tried giving the horse jump boost 250, but apparently that doesnt work on mobs
Horse jumping is client-sided so you can't really cancel it anymore
yeah but i wanna know if theres some server-side trickery i can do
I mean, if it's client-sided, probably not ;p
actually
lemme try forcibly teleporting the horse down
or is it possible to set a horse's y velocity to 0
ok setting it's y velocity to -2000 actually worked
I'm making fireballs work in my plugin but only break blocks that were placed by a player (and are not part of the map)
I've managed to get it working the only issue is the fire the fireball does is only on the destroyed blocks
I've tried making the fire by myself by randomly putting it around the fireball but it is a bit complicated
Is there a better way to do that?
ow
Would it take up much more space if I added some NBT to every single Block placed by a player?
I want it so I have a difference between natural and player placed blocks
just have a list
and update it when they place a block
Hashmap<UUID, List<Location>> or something
save it to yaml and retrieve it on startup
or some other storage sstem
how can I revert the velocity of an entity?
Revert?
I mean if it goes at a certain speed north I want it to go the same speed but south
but for all directions haha
Multiply it with minus, maybe?
That worked!
Thanks :D
๐
Yeeee, that's actually what I meant...
Takes up a few bytes per block?
I don't really know the details about that, but Chunk has a file size limit iirc.
depends on what you wanna store
The UUID of the player who placed the block
that should not really make a difference
Okay
what would be the method of getting two blocks infront of the player?
You get the direction of the player and multiply it by 2
smort
ty
smt like this? twoBlocksAway = player.getLocation().add(player.getLocation().getDirection().multiply(2));
yes yes
sweet ily
is PlayerInteractEvent supposed to fire 2 separate events for the main hand?
I believe one for each hand,
if I hold an item in my hand and right-click it fires 2 events for the main hand.
but if I right-click a block it only fires 1 for the main hand
are you talking about multiple events?
2 interact events are being called when I right-click air with a potion in my hand and the getHand() returns HAND for both.
I only have a single interact event registered
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
Oh I see
beats me ยฏ_(ใ)_/ยฏ
you'll have to give us something more
debug messages, logs, video, code whatever
also different scenarios would be good and what you are doing
Hey i have an error: I have that 2 methods:
for (String strs : settings.getConfigurationSection("menu").getKeys(false)){
if (!Gui.isHead(settings.getString("menu.items."+strs+".material"))){
System.err.println(errorSettings+"You need to put a valid material as menu.items."+strs+".material.");
return false;
}}```
```java
public static Boolean isHead(String str){
if (str.charAt(0) == '-' && str.charAt(1) == 'h' && str.charAt(2) == 'e' && str.charAt(3) == 'a' && str.charAt(4) == 'd'
&&str.charAt(5) == '-'){
return true;
}
return false;
}``` and my error is `Cannot invoke "String.charAt(int)" because "str" is null` but my config is: ```yaml
menu:
items:
1:
material: "-head-eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWU0MzUyNjgwZDBiYjI5YjkxMzhhZjc4MzMwMWEzOTFiMzQwOTBjYjQ5NDFkNTJjMDg3Y2E3M2M4MDM2Y2I1MSJ9fX0="
warp: tnt
slot: 3``` why?
because menu.items.items.material probably doesnt exist
hmm lol
actually I need to put: for (String strs : settings.getConfigurationSection("menu.items").getKeys(false)){
exactly
thanks
Is it possible to choose the unloading order on plugins? Like, when the server stops, I first want to unload plugin b, then plugin a, ...
after 18 hours of tedious trying i got nms to work smoothly only to find out it wasnt the solution to my issue lmao
Why u need this?
Just depend on a plugin so u can disable before it
I used RecipeChoice.ExactChoice(item) in ShapedRecipe. the item is an arrow with custom model data and when I click on the recipe in the knowledge book it says i need a regular arrow instead of the custom one. any ideas?
this is the code RecipeChoice bundle = new RecipeChoice.ExactChoice(arrows.Bundle); Diamond = new ShapedRecipe(new NamespacedKey(plugin, "diamond"), arrows.Diamond); Diamond.shape("DDD", "DBD", "DDD"); Diamond.setIngredient('D', Material.DIAMOND_BLOCK); Diamond.setIngredient('B', bundle); Bukkit.getServer().addRecipe(Diamond);
@EventHandler
public void onInteract(PlayerInteractEvent e) {
System.out.println(e.getHand());
}
this is my code and when I right-click air with a splash_potion in my hand it throws 2 interact events for the HAND hand.
when I right-click with a dirt block in my hand it only throws a single interact event for the HAND hand.
not sure why it's calling twice when holding a splash_potion maybe I'm missing something.
I need to check some conditions on an item before allowing interact and whatnot
The recipe works fine but the shown items in the knowledge book are regular arrows
This is known. I forgot why but md_5 commented on it. Maybe you can find that
is it like a bug or?
this is when i input the recipe
this is what i get with the knowledge book
Create a minimal reproducible plugin
Can't remember and I really can't find his message either
As little code as possible to replicate
all you need is a listener with
@EventHandler
public void onInteract(PlayerInteractEvent e) {
System.out.println(e.getHand());
}
and right-click the air with a splash_potion in hand.
Either way it's not hard to work around if needed
Print the hand, the item, the time in millis and the action
I don't understand, I have all of the needed items and its marked red
https://i.imgur.com/UKrb0Yz.png
this is what gets printed when I right-click air
also sorry YTG667 I'm making your issue hard to see mb
Right and left click air
create a thread
How tf is that possible
actually i've had this issue too with a rod
What version
latest 1.18.2
"fixed" with a list
private boolean cancelledDuplicateRodClick(UUID uuid, Action action) {
if(action == Action.RIGHT_CLICK_AIR) {
rod_click.add(uuid);
} else if(action == Action.LEFT_CLICK_AIR) {
if(rod_click.contains(uuid)) {
rod_click.remove(uuid);
return true;
}
}
return false;
}
no, you just have no idea what you're doing
please, anyone?
what kind of weird arrows are that
resource pack i guess
arrows with customModelData
I was having an issue here not the same but a weird one
looks like I'm able to get around it by ignoring the LEFT_CLICK_AIR action.
good enough for me
.
That's normal. ExactChoice with custom data confuses the client. Has always been like that
because the player has two hands
For the same hand
so what should i do?
See here alex
its for the same hand alex
both times the same Action?
Nope diff actions
you can't fix this. it's a client thing
Nah it wasn't
btw what "rod" do you mean? fishing rod?
hmm
yes
already has been reported as a bug
Wouldn't a boolean fix this?
Instead of a list
wdym
Only one event can be fired at any point
you got a link? all I can find is a bug report about how it gets called for both hands
Replace the list with a boolean called rightClickingAir
wont work since its for multiple players
ooh wait you're talking about left click and right click, yes?
if so that is actually intended behaviour
Ye
yes
Why?
because md5 said it can't be fixed without breaking a ton of other stuff
idk let me find the issue
oh well, good point then
Maybe right clicking air with all?
i think i remember why i did it like this
you can actually fire the same event twice at the same time
with f.e. double clicks which happen with a 0 ms delay
I guess every material that shows the "hand swing animation"
speaking of hand swing animations
are you guys aware of any other sources of hand swing animations i should be aware of
currently i got interact block, damage block, drop item, and attack
you can always listen to animation packet if you're uncertain
no thats what i mean
i need to be able to distinguish between the reasons a player swings their arm
using it for an increased attack range attribute but theres like an issue with the interact event where it doesnt work consistently so now im using a playeranimationevent listener
but i dont want players to perform a ranged attack when they drop an item or interact with a block and stuff like that
so currently i only got those 4 reasons and i just wonder if there's any more
Hey guys, I'm making a plugin and target Java 8 to make it compatible to all the users that still use older java version. Problem is I need to import a dependency in Java 17 (but not compile it inside the plugin) through Gradle.
So I get this error : Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 8.
Is there a way to counter this?
I got a question,
Im using the PlayerExpChangeEvent, and it says its only called on natural exp changes, does that include using an experience bottle thingy?
Cuz im making a thing to double the amount of experience a player gained, and modifying this seems like the easiest approach, but if it includes bottle of enchanting, then that could lead to infinite xp since there are loads of plugins which can "deposit" your xp into those bottles
Hello i have a null pointer exception when use getconf in my class. https://ibb.co/FKxXxn4
That would be because somethings null
id guess either the return of getConfig or your path is wrong
it has like a little warning line under getConfig so are you sure main isnt null
it would include anything that involves absorbing experience points
and to get around the infinite experience stuff you'd just have to make it configurable
or you could look into editing experience orbs released from experience bottles to not be counted
that doesnt seem possible with the current api
wack
ok, next question, is there a method or smthn which I can call to manually grow a crop?
like
if(crop.isGrowable)crop.grow();
ik I could manually edit the age of a crop, but this doesnt take care of crops like sugarcane or cactus, and then I also have to figure out of the crop is at the correct light levels has enough water ect.
Or, is there a way to manually "tick" a block, in an attempt to speed up the crops growth?
im sure you could but you'd have to use nms for it
you can set the growth stage in a blocks block data iirc
i think its called Growable or smth
or a block state
I dont know how to say this but, I love you
I have quite possibly the most buggy results but it works ๐
Ageable
Yep u can, i wana avoid that tho since it doesnt work with cactus sugarcane bamboo ect
yes but they dont have different states
its just 1 state since they grow into different blocks
is there any special blockstates for those kind of blocks
could make a util for that
maybe use a runnable to check if theyre ready to grow another block
Hence my origional question
.
Is there a way to check if a crop can be grown, and manually force it to grow
isnt like cactus and sugarcane and bamboo like random growth
Its tied to randomtickspeed
I want a way to increase that
But only in certain locations, so i dont want to alter the global tick speex
might have to look into nms
static final EnumSet<Material> multiblock = EnumSet.of(
Material.CACTUS,
Material.BAMBOO,
Material.SUGAR_CANE // idk what it called
);
public int getAge(Block block) {
Material type = block.getType();
if (multiblock.contains(type)) {
// measure blocks above
int h = 1;
Location loc = block.getLocation();
final Vector incr = new Vector(0, 1, 0);
while ((loc.add(incr)).getBlock().getType() == type)
h++;
return h;
} else {
return ((Ageable)block.getBlockData()).getAge();
}
}
public boolean setAge(Block block, int age) {
Material type = block.getType();
if (multiblock.contains(type)) {
Location loc = block.getLocation();
final Vector incr = new Vector(0, 1, 0);
while ((loc.add(incr)).getBlock().getType() == type);
loc.add(incr);
Block block = loc.getBlock();
if (block.getType() == Material.AIR)
return false; // cant replace air
block.setType(type);
return true;
} else {
((Ageable)block.getBlockData()).setAge(age);
return true;
}
}
``` @radiant aspen
lmao
Yeah, its certanly possible to code it all out, but id also need to check for light levels if it has enough water ect
Im wanting to know if there is an official method
If not, then yeah id have to do it manually which is a pain
But thx for ur help
could someone help me out a bit?
I'm making a custom rank plugin for my server but i'm having some trouble with setting up the commands
Any issues? Explain what you need
not really an ISSUE but i need some help with setting up the rank set command
show what you have
what exactly do you need help with
elaborate what you need
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
so here's my code (its currently not that long for this class)
and I need someone to tell me what exactly i should write under there (where the cursor is) so i can set a player's rank with this command
put that check inside the sender instanceof Player
and we need some context
what are you using for ranks?
move the ! instanceof up so you early return. No point in creating a Player variable if you are not going to use it
wdym what am i using
like luckperms or what
this is also a registered CommandExecutor. You never need to check teh command unless you are registering the same executor for multiple commands
with this code i cant expect a custom rank system
this is the command class
no shit sherlock
we have 0 context on how you are doing your ranks
its like giving a child a book when they haven't learnt how to read yet
i cant read
Isnt that how kids learn to read tho?
It's like asking a dev to do the work, but instead of having the dev typing the keyboard, it's him
Lmao
Everyone tries to eat their first book. Have to start somewhere
ok then
giving a child shakespeare when they haven't learnt how to read
i remember trying to code a plugin in a java main method
But yeah, what u trying todo
ight im going back to reddit + the spigot libraries, i knew i wasnt gonna get help here
i would more say its like giving a blind person a book full of pictures
that was only like 5 months ago
What u trying todo lmao
answering our questions would help
You will get help, but people will laugh too
U just came in here, said help with no context and then left
We dont know what u trying todo
@regal sigil You are clearly asking us to make the job. You should first look some tutorials on how to do a plugin. Then you can create your own. We can't help you like that, except if your request a plugin with a good description maybe someone would like to help you
all we know is you want to set a players rank. but we have no idea what ranks you have or are trying to use
i would lik to have a bedwar plugin
i will literally shut the f*** up and never ask for help or sth if you give me ONE good tutorial for how to make a rank plugin with commands and everything on 1.8
like literally
What exactly do u need help with
I changed my mind, maybe no one would like to help you like that
This is like hiring a bunch of builders and saying buold a house
U need an archetect to plan shit out
oh we are still comparing?
What exactly do u want the command to do?
Yes
Creating a plugin is not copying someone who already made it: for that just download an existing plugin.
If you want to make your own, just learn how to code, then it will be easy and you'll have plenty of possibilities to make it
nah i just
worldedit and smooth
and then cry
because i suck at building
?learnjava moment
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.
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
Ranks are generally taken from your Permission plugin, LuckPerms, GroupManager etc. You read the players primary group or prefix.
selfadvertising
But yeah, why do u even want to make ur own rank plugin, just use luckperms
Facts ;D
Then if for some reason u want to do custom stuff use their api
He went back to reddit
anyways, how do i get the player inside my main method
Why u using methods for?
what is a method
yeah i heard about that
God classes are best
Try to avoid making multiple class
Why would you need more than one class?
Oh, and always to remember to abide by the wet principles
Dont be lazy and just write smthn once
Gotta do multiple times
oh btw. we also have an permissions system in there
