#help-development
1 messages · Page 87 of 1
and this please^
NPE dodging
I said that when I use the totem for like 3 times the server crashses
so um, I had this bug with minecraft where any versions 1.18 and above would freeze every 1 second, meaning the graph would be some thing like this:
300 -> 1 - 250 -> 1..etc
so well i used some jvm args i got recommended which ill send later,
and that fixed it, however after 3 days the bug is back, but i realized something, when the bug was fixed i had 2gb allocated and it was using 2.7gb, but when the bug still existed it was using 2gb flat, so i thought maybe that was the problem, i just tried allocating 3gb or 4gb and no luck.
the jvm args are here: https://pastebin.com/3mK9yZFf
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.
repost!
very weird server you have
And i don't think this event is the problem
could be the server?
STOP SPAMMING please. It has been 3 days bro, create a thread
It's some guy host not mine
how is that spam
it got flooded in approximately 2 seconds
yeah ngl i've seen that message now like 10 times
i dont think it's considered spam if you only see it for a few milliseconds
I don't think it's up to you what other people consider as spam
too bad then
You just cut the convo in two pieces, and yes it's spam since I saw your message (exactly the same) more than 5 times
didn't you have a thread about that already?
no
wth are you even trying?
Time to create one
what is the guy trying to do?
create one and I'll try to help you there so we finally get this fixed :d
idk
it's generally okay to use player names
if it's not persistent data
a bug that no one has ever had in minecraft
I mean, the problem is that the server crashes and I don't know why
comparing string would have to loop thro the whole string where UUID::equals just checks two longs
check logs
if you dont know what your coding makes sense that the server crashes then
shouldn't there be something in the console when the server crashes?
yes
should have a look at that then
actually uuid.equals
just compares
the msb and lsb
thats what i say
I got a project which I tried to make an additional module for older mc versions. Then I am meant to get the version wrapper by doing return (ItemVersionWrapper) Class.forName(getClass().getPackage().getName() + ".Wrapper" + serverVersion).getDeclaredConstructor().newInstance(); However its not finding the class
my project is too large to pastebin so I'll link my github https://github.com/KyTDK/NeoUtils
this is the class I need to retrieve https://github.com/KyTDK/NeoUtils/blob/master/LEGACY/src/main/java/com/neomechanical/version/items/WrapperLEGACY.java
smth happened to my spigot account all my purhcased resources are gone except 2
probably a #help-server question
anyways for my issue, if its legacy then its meant to find WrapperLEGACY
however, I'm not sure how I find that class when there are in different locations
I don't think this is the right channel for this, and I don't even think advertising is allowed
Yes, I check for inventory name. :giga_chad:
D:
I'm trying to add multiple enchants but it is giving me the error cannot set already-set enchantment. It was working before and I'm not sure what happened.
public static final Enchantment TNTSHOOTER = new EnchantmentWrapper("tntshooter", "TNT Shooter", 1);
public static final Enchantment VORTEX = new EnchantmentWrapper("vortex", "Vortex", 1);
public static void register(){
boolean registered_tnt = Arrays.stream(Enchantment.values()).collect(Collectors.toList()).contains(TNTSHOOTER);
boolean registered_vortex = Arrays.stream(Enchantment.values()).collect(Collectors.toList()).contains(VORTEX);
if (!registered_tnt){
registerEnchantment(TNTSHOOTER);
}
if (!registered_vortex){
registerEnchantment(VORTEX);
}
}
public static void registerEnchantment(Enchantment enchantment){
boolean registered = true;
try {
Field f = Enchantment.class.getDeclaredField("acceptingNew");
f.setAccessible(true);
f.set(null, true);
Enchantment.registerEnchantment(enchantment);
}
catch (Exception e){
registered = false;
e.printStackTrace();
}
if (registered){
System.out.println("REGISTERED: " + enchantment);
}
}
}
As far as I am aware the tutorials I looked at call the register method every time the server starts or reloads which then registers the enchants
which version are you coding against?
The version of minecraft?
yes
1.19.2
if its already set its already set, makes sense no?
Couldn't you just add a check to only set it if it's not already set?
You mean the if(!registered) part?
that only happens when you do /reload or when you recall the method
do java if (Enchantment.getByKey(YOUR_KEY) != null) return;
Why am I the only one to have a plugin that adds new enchantments but doesn't register them?
?
Everyone registers their enchantments to bukkit even though that process isn't strictly needed
Ah alright
yes and not
methods like Enchantment.get... will not return the enchantment
wait, this is for the register method right?
yes
How would I change a string to a namespacedkey?
Ah thanks
feature creep strikes again
I now have a monstrosity in my hands once again
my simple config creation tool is officially no longer simple at all, it went from requiring a fileconfiguration a key and a value to set a string to now also requiring the file, if the string is translatable and now I'm trying to figure out how to inject inline/multiline comments on top of that
and also somehow it got split up in two parts so there's also that
The issue is in the ClearChat class
^
remove the extends JavaPlugin
wait how do u do DI from main class then lol
static ig?
thats what i always did
i mean like
Use a bootstrap plugin
^^ your main class basically just constructs your actual main
The issue only applies when using bukkit's plugin loading logic - but if you do it yourself you do not have this issue
And delegates the onEnable and onDisable
so
bootstrap has all the listener registering crap and shit
and main just calls bootstrap methods?
Well no bootstrap configures your DI
In guice you'd register bindings etc
Then bootstrap (which extends JavaPlugin) creates your actual main class (which does not extend java plugin tho)
sounds like oop
I eventually want to create a wrapper around bukkit that only uses Object and primitives
a
var ❤️
Although I have discovered that mixins are viable in bukkit space so it will only use Object and primitives at runtime
isnt var just like js var
No, var is basically a placeholder
ye
the compiler (javac) will guess what type you mean
No
Neither
It's still a static type
what
As I said, just a placeholder
You cannot redefine the type later on
The type will be guessed by the compiler from the INITIAL ASSIGNMENT
Future assignments are ignored
I believe so at least
i feel urge to learn scala
So at compile time you'll still be able to use bukkit-like structures
var is for the weaks who dont like to write the ObjectFactoryAndWrapper oaaw = ...
u know this feeling when u jump to kotlin project
and you wanna use getters
wow what an unusual variable naming
why do I hate this do much
help with what?
start by not naming your variables Survival_meta
Your issue is your variable names aren't camel case
I'm only recently very active here, have people here always been using bad naming?
Rarely. Most questions are answered through simple docs searches
nah I just stopped bothering about teaching best pratices. I just wonder where people learned them
Or like learned to do it the wrong way
some shitty tutorials probably
from people not knowing stuff themselves
But there's soo many good tutorials for java out there :(
have a look at coding with john
this dude is awesome
Perhaps you want to send the rest of the code?
It might be a problem with your serverselector inventory
Personally I used to learn from reading source codes and reading books from authors who are programmers and have been in the industry for a solid amount of years, tho Ig youtube can be helpful
ItemStack[] menu_items = {Survival, Skyblock, Oneblock};
serverselector.setContents(menu_items);
player.openInventory(serverselector);```
this will just set them to the first empty slots iirc
why are you even adding that when you are setting the slots manually earlier
you literally have it and then overwrite it
indeed
yup
and please refactor all those variable names
registered the command?
and added to plugin.yml
Also you can use singleton list instead of 1 entry array list ^
show how you registered it
do you still open the inventory to the player
shouldn't remove that line in case you done that
anyone? #1012313792488681492
Am I suppose to register like this? Because usually I do a dependency injection and register the class as a command/listener in the class constructor, so my main class is just “new Class(this);”
Hey guys, just wonering if anyone would have an idea how to create some kind of scientists like they are in the game "Rust"... Basicly they sould be npcs (or an minecart or something like that). They should stay in a fixed location and you cannot move them. They should also shoot arrows and rotate to a players direction and detect them in a specific radius?
It doesn't matter, you can do like this too
Ok thank you!
Yea it works this way
Can't really help with the amount of code you sent
also seems kinda weird that you have to use speed twice
"this.x" looks like you wanna walk to your current location?
also what did you set "speed" to?
what kind of entity is it?
okay i'll try something
does someone here has an installer for github source?
oh wait, did you only override the start() method?
nothing else?
try to do nothing in start(), and only do getNavigation().moveTo(x,y,z,3); in the tick() method
just to see whether it works at all
it works perfectly
I need help with this again, I am trying to register multiple custom enchantments but I keep getting the error cannot set already-set enchantment
Code:
public static final Enchantment TNTSHOOTER = new EnchantmentWrapper("tntshooter", "TNT Shooter", 1);
public static final Enchantment VORTEX = new EnchantmentWrapper("vortex", "Vortex", 1);
public static void register(){
System.out.println(Arrays.stream(Enchantment.values()).collect(Collectors.toList()));
boolean registered = Arrays.stream(Enchantment.values()).collect(Collectors.toList()).contains(VORTEX);
if (!registered){
System.out.println("IT IS NOT REGISTERED!!!");;
}
}
public static void registerEnchantment(Enchantment enchantment){
boolean registered = true;
try {
Field f = Enchantment.class.getDeclaredField("acceptingNew");
f.setAccessible(true);
f.set(null, true);
Enchantment.registerEnchantment(enchantment);
}
catch (Exception e){
registered = false;
e.printStackTrace();
}
if (registered){
System.out.println("REGISTERED: " + enchantment);
}
}
}
I am not sure why it is giving me the error when I put registerEnchantments(VORTEX) in `if (!registred){
}
@small peak
I just removed all goals and targets, and then added one target that just does moveTo(closestPlayer) itn he tick() method
no
print out the results of all your methods
It prints out that it is not registered but says it already set the enchantment
e.g. canuse -> true, false
whether start or stop runs(), whether tick runs(), etc
I'm currently really only doing moveTo(closestPlayer) and that works fine, so it must be sth wrong with your logic itself
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
JeffLib.enableNMS();
Player player = (Player) sender;
Blaze blaze = (Blaze) player.getWorld().spawnEntity(player.getLocation(), EntityType.BLAZE);
EntityUtils.getGoalSelector(blaze).removeAllGoals();
EntityUtils.getTargetSelector(blaze).removeAllGoals();
EntityUtils.getGoalSelector(blaze).addGoal(new CustomGoal(blaze) {
@Override
public boolean canUse() {
return true;
}
@Override
public void tick() {
Player target = EntityUtils.getClosestPlayer(blaze);
getNavigation().moveTo(target,3);
}
}, 0);
return true;
}
appreciate if perhaps someone could take a look and maybe explain what went wrong or why the error is popping up 🤗
np! Mind explaining what the problem was?
registered is always true in the registerEnchantment method
nvm
am blind
Make sure you're not reloading the server
Why?
because you'd register the enchantment twice then
just ignore the exception in your try/catch
or don't reload
if (!registered){
System.out.println("IT IS NOT REGISTERED!!!");
registerEnchantment(VORTEX);
}``` That's why I have this if statement
You're not using that in the registerEnchantment method
give me a second I forgot to copy 1 line
You're only setting the registered boolean by catching the error
VORTEX doesn't properly override the equals() method
your VORTEX object will not be equal to the already registered VORTEX object
instead of checking if the list contains it, stream and filter it by the enchantment's namespacedkey
or, simply ignore the exception
also...
try this:
boolean registered = Arrays.stream(Enchantment.values()).anyMatch(alreadyRegisterd -> alreadyRegisterd.getKey().equals(VORTEX.getKey()));
ok
and as olivo said, only call registerEnchantment(...) when registered is false in your register() method
Yea that's the part I'm confused about because the list does not contain the vortex enchantment yet it is already set?
but I'll try this first
as I said, the list does not contain your current VORTEX object
it contains your VORTEX object from before reload
and since it's a new VORTEX object and you do not override equals(), it just checks for the memory address
public class ModEnchants {
public static final Enchantment TNTSHOOTER = new EnchantmentWrapper("tntshooter", "TNT Shooter", 1);
public static final Enchantment VORTEX = new EnchantmentWrapper("vortex", "Vortex", 1);
public static void registerEnchantment(Enchantment enchantment){
boolean registered = Arrays.stream(Enchantment.values()).anyMatch(alreadyRegisterd -> alreadyRegisterd.getKey().equals(enchantment.getKey()));;
if(!registered) {
try {
Field f = Enchantment.class.getDeclaredField("acceptingNew");
f.setAccessible(true);
f.set(null, true);
Enchantment.registerEnchantment(enchantment);
System.out.println("Successfully registered " + enchantment.getKey());
} catch (Exception e) {
System.out.println("No need to register " + enchantment.getKey() + " as it's already registered from before reload");
}
}
}
}
This is how I'd do it, except for the reflection part
hmmm I see
you can easily see why List#contains() doesn't work here:
Enchantment vortex1 = new EnchantmentWrapper("tntshooter", "TNT Shooter", 1);
Enchantment vortex2 = new EnchantmentWrapper("tntshooter", "TNT Shooter", 1);
System.out.println(vortex1.equals(vortex2));
this will probably print "false"
so List#contains is also false
oh that's so strange
how so? it makes perfect sense
you could just override equals() in your EnchantmentWrapper
how would i check if the data dir exists and if it doesn't, create it
Oh wait I saw it wrongly
if(!getDataFolder().exists()) getDataFolder().mkdirs();
ok
but that should never happen for plugin data folders
anyway, I just always use mkdirs
alr
is that ur lib?
bruh
thats mega awesome
Use , instead of +
ok
the EntityUtils and CustomGoal stuff? Yeah that's from JeffLib
File file = new File(Bukkit.getPluginManager().getPlugin("Lifesteal").getDataFolder(), "file.txt");
lmao
nice
is it possible to make entities
attack and stuff?
e.g make the entity use a bow
to shoot a player
I haven't added that yet. I only wrapped pathfinder goals, Navigation, JumpControl, MoveControl and LookControl yet
but PRs are always welcome lol
Any idea why this```java
player.getOpenInventory().getTopInventory().clear();
player.updateInventory();
The inventory view just stays the same
Hi,
I have a problem with this segment in my plugin
case "team" (line 139 - 181) updates the variable correctly but does not save it to the yml file.
The other cases save in the same method (unless ive mistyped) and work as intended.
I've been stuck on this for hours now
Anyone know why this might be?
https://pastebin.com/kEB3nRA8
It's a bad idea to load the file that many times
its likely to be changed by other classes
its the only way i could think of that doesnt use databases
You load it once and save when needed
Then simply reuse the loaded instance elsewhere
that'll still be saving and loading the same amount of times
Hi. I remame armor stands -stored by UUID, not by Entity or AmorStand. When I rename these, on one client all stands will be renamed, on the other client not.
Anyone any idea on why this could be happening?
Not even close
so i load it
wait until its used
as soon as its used save and reload
and it still doesnt answer the original question
ok
but that doesnt explain why it wont save
its the file saving in that one specific part thats the issue
I was wondering if you run Player#openInventory while another inventory is open, Will it send Close Inventory Event or it will be skipped?
I would guess that you get the event but feel free to test that
any know what a class in 1.12.2 change to in 1.16 api ?
it calls the close event
decompile EntityZombie and look for methods with matching parameter types
mfnalex do you have any idea why an entity would be updating it's display name for player A but not for player B?
Show how you're renaming the armorstand
private ArmorStand getArmorStand(int id) {
if(id < 0 || id >= entities.size()) return null;
else return (ArmorStand)Bukkit.getServer().getEntity(entities.get(id));
}
private void updateArmorStandName(int id, String name) {
ArmorStand stand = getArmorStand(id);
if(stand == null) return;
stand.setCustomName(name);
}
Make sure that both clients are running vanilla
I am running optifine on both clients.
I have had this issue for a while and thought it was resolved, how I remember this issue occurring with vanilla too.
One thing that has come to my attention is that the first player teleported to the world will have armor stand one with the correct name and armor stand 2 with an incorrect name.
Although I have tried pushing another update from the armor stand after a delay, which hasn't resolved the issue.
hmm no idea
How can I make a path using the navigation that the entity can fly?
this method track entity interactions as(player rightclick/leftclick)
what is the method for it?
( i want to use it in this nms entities so no thank to events)
.
no idea*
?
Use FlyingPathNavigation
setvelocity to 0,-1,0 ?
Vanilla has plenty of examples
Take a look
That is how things are when working with NMS
Same goes for you @vital sandal
If you have no idea how to read decompiled code you might want to keep using the api instead of nms
@tender shard help
Don't ping him for that ._.
decompile EntityBlaze
Now look at how the entity is moved around
https://hastebin.com/adibuyuqef.kotlin
Hello, does someone know why this code is sending twice, messages etc. is sending twice and i dont know why
I added the equipmentslot hand check, and it still doesnt work
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
https://hastebin.com/evijahegas.kotlin like this?
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Thanks i will change the main class name
But it still doesnt fix the problem of sending messages and doing handlings twice
its flying only when he is attacking
ok
if u hold the click it spamming sending right ?
Not much I can help you with there. You'll need to figure that out yourself. I don't have time to open my IDE and figure out how things work
When working with nms you're mostly on your own
Yes i guess, but normally it would send messages once not twice so i dont know how to fix it
u may add cooldown to that event :>
Did you register the listener twice?
some event trigger continously
when y’all handle economy do you make your own custom or use an econ plugin like vault
No i didnt
Also this sounds like a question for #help-server
How can i simply add 1 second cooldown to the whole event?
Keep a map of player uuid and timestamp since last triggered
Thanks i will try that!
add player to a map and a runtasklater at 20tick to remove player from map
Thats even better thanks!
repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
content {
includeGroup 'org.bukkit'
includeGroup 'org.spigotmc'
}
}
mavenLocal()
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
}
PlayerInteractEvent if (e.getAction() == Action.RIGHT_CLICK_AIR) { if (p.getItemInHand().getType() != Material.MUSHROOM_SOUP && p.getHealth() >= p.getMaxHealth()) return; p.setItemInHand(new ItemStack(Material.BOWL)); p.setFoodLevel(20); p.setSaturation(20); if ((p.getHealth() + 8) > p.getMaxHealth()) { p.setHealth(p.getMaxHealth()); } else { p.setHealth(p.getHealth() + 8); } } it doesnt replace the item in my hand, but it does it the action is right click block
What item are you holding?
Any ideas?
mushroomsoup
it sets my food level, adds the amount to my health
but it doesnt replace the item
i have a debug
it just puts the itemstack thats in my hand into chat
is that the entire event?
yes
so it works
@EventHandler
public void onSoupClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_AIR) {
checkItem(p);
p.sendMessage(p.getItemInHand().toString());
}
}
private void checkItem(Player p) {
if (p.getItemInHand().getType() != Material.MUSHROOM_SOUP && p.getHealth() >= p.getMaxHealth()) return;
p.setItemInHand(new ItemStack(Material.BOWL));
p.setFoodLevel(20);
p.setSaturation(20);
if ((p.getHealth() + 8) > p.getMaxHealth()) {
p.setHealth(p.getMaxHealth());
} else {
p.setHealth(p.getHealth() + 8);
}
}
}```
but only on blocks?
so is the issue you want it to work in air also?
yes
ok so basically use a logical or
it just doesnt change the item to a bowl
in java compare method is eQualto
@EventHandler
public void onSoupClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
checkItem(p);
p.sendMessage(p.getItemInHand().toString());
}
}
would this not do it?
try p.updateinventory()?
alr
or this player.getInventory().setItemInMainHand()
tried that already
didnt work
(!p.getItemInHand().getType() .equals(Material.MUSHROOM_SOUP)
why would that change anything
not what this channel is for
just try it man
not what the discord is for
where am i even meant to put that?
do i need an if?
what does that accomplish?
His problem is at setiteminhand
is it being called?
sir can you put some sort of player message just below the setitemline
i did
and let me know if the message gets sent
i am just trying to help man im sorry
im not repeating everything
private void checkItem(Player p) {
if (p.getItemInHand().getType() != Material.MUSHROOM_SOUP && p.getHealth() >= p.getMaxHealth()) return;
p.setItemInHand(new ItemStack(Material.BOWL));
p.sendMessage("test message!");
p.setFoodLevel(20);
p.setSaturation(20);
if ((p.getHealth() + 8) > p.getMaxHealth()) {
p.setHealth(p.getMaxHealth());
} else {
p.setHealth(p.getHealth() + 8);
}
}
have you done it like this
apex do we know if setitem is actually being called ?
tried that
what does that even mean
Try to put p.setiteminhand before everything
So the problem is p.setiteminhand ...
And what version is your?
1.8.8
im bout to fix this on my server gimme a sec
alright i have fixed it
If(a) return:
If(b) return;
Wdym ?
mysql function
if u dont know googling wont help us here xd
since i run an advanced command
and not sure how to implement the function correctly
google it lol
lmao
how should i put it correctly to get higher amount?
when i first started making plugins i would get people telling me to learn java now i understand
BETWEEN lol
by your code
i have no idea
nah between is not working bruh
so i went manually
haha
i did between before
it just made an error
dunno youre using () bruh
whats wrong in my command here?
like the syntax at the end is bad
im trying to return 1 by limiting and the highest
i dont want to use subquery..
why your function is private?
cant really understand
not my code man
i was trying to get the guy to debug and see if the guard function was working properly
Why not private ?
?java
?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.
?jd
@EventHandler
public void onSoupClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
checkItem(p);
}
}
private void checkItem(Player p) {
if (p.getInventory().getItemInMainHand().getType().equals(Material.MUSHROOM_STEW) && p.getHealth() >= p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue())
return;
p.getInventory().setItemInMainHand(new ItemStack(Material.BOWL));
p.setFoodLevel(20);
p.setSaturation(20);
if ((p.getHealth() + 1) > p.getMaxHealth()) {
p.setHealth(p.getMaxHealth());
} else {
p.setHealth(p.getHealth() + 1);
}
}
@mighty pier
this is the working 1.19 code of your function
just swap the new ones for the appropriate
also work on the if statement at the bottom there is much better way of doing it
i think you better implement the self function
its no sense to make it sperate
and either private for no sense
yes
like what gonna accses it already
cloud be way more simple you either hardcore everythin
cloud
a
or just something you would need to accses from everywhere
there is need for me
why?
i mean i get both your points but wdym use it twice
and
where else is that going to be used
i keep deleting it to test it
you didnt fix it
i dont understand why you think that thatll fix it
yes
send the orginal code please
i cant understand that kind of shit even
like
why you would use it
i find it
@EventHandler
public void onSoupClick(PlayerInteractEvent e) {
if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) return;
Player p = e.getPlayer();
checkItem(p);
if (e.getClickedBlock() != null){
checkBlock(p, e.getClickedBlock());
}
}
private void checkItem(Player p) {
if (p.getItemInHand().getType() != Material.MUSHROOM_SOUP && p.getHealth() >= p.getMaxHealth()) return;
p.setItemInHand(new ItemStack(Material.BOWL));
p.updateInventory();
p.setFoodLevel(20);
p.setSaturation(20);
if ((p.getHealth() + 8) > p.getMaxHealth()) {
p.setHealth(p.getMaxHealth());
} else {
p.setHealth(p.getHealth() + 8);
}
}
private void checkBlock(Player p, Block b) {
if (b.getType() == Material.SIGN_POST || b.getType() == Material.WALL_SIGN) {
Inventory gui = Bukkit.createInventory(null, 54);
ItemStack item = new ItemStack(Material.MUSHROOM_SOUP);
for (int x = 0; x < 54; x++) {
gui.addItem(item);
}
p.openInventory(gui);
}else{
checkItem(p);
}
}
}```
you can argue that i dont need the checkblock funciton
cause i dont
i will remove it when my problem is fixed
works fine 1.19
im not using 1.19
i told you, you have to switch them out for the correct 1.8 ones
that looks so ugly, just use early returns
i dont think any person can fix this
this is the spigot discord server
not forge, fabric or whatever youre using
vanilla
not a java learning center
public class Click implements Listener {
@EventHandler
public void onSoupClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
// this is shit p.sendMessage(p.getItemInHand().toString());
if (p.getItemInHand().getType() != Material.MUSHROOM_SOUP { return;
} if ( p.getHealth() == p.getMaxHealth()) {
p.sendmessage("i feel healthy");
return;
}
p.setItemInHand(new ItemStack(Material.BOWL));
p.setFoodLevel(20);
p.setSaturation(20);
p.setHealth(p.getMaxHealth());
}
}
discord formatting did this dirty
lmao
yeah but its way shorter
not sure what was the point of adding 8hp
like player hp == 20 max in general
so if he has 12+8 it be 20
but if he has 11 it will be 19
if he has more just setting to max?
cloud not get the concept of it
i want to add 8 health
4 hearts
wouldnt it make more sense to use the PlayerConsumeItemEvent?
there is slow down when you eat
thing
yeah so he want on interact event
force it to add hp
like pvp soups
back then
idk i honestly cant understand the problem here
you dont need to
public class Click implements Listener {
@EventHandler
public void onSoupClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
// this is shit p.sendMessage(p.getItemInHand().toString());
if (p.getItemInHand().getType() != Material.MUSHROOM_SOUP { return;
}// if ( p.getHealth() == p.getMaxHealth()) {
// p.sendmessage("i feel healthy");
// return; ussless no one needs it as well if they decided to use it when they are full hp its their own issue
}
p.setItemInHand(new ItemStack(Material.BOWL));
p.setFoodLevel(20);
p.setSaturation(20); //wtf is Saturation?
p.setHealth(p.getHealth + 8); // it will not override max hp as well
}
}
i already said i will remove the function after my problem is fixed
what is the problem
this will work
there nothing wrong with the code i send
and it does same function as your code do
and its 4 times shorter
bro wtf your the one who is bad at java
lol
frandma go to stackoverflow
learn to read
that chat is gettin spicy
and read what i sent
mspigot discord drama time
p.setItemInHand(new ItemStack(Material.BOWL));
see his code before
it doesnt replace the item
p.setItemInHand(new ItemStack(Material.BOWL)); doesnt work after i check if player right clicked air
i tried that
1h before typing here
🥶
i did .gettype
wait wait i fix this brick head code
it returns a material
player.getItemInHand().setType(Material.BOWL);
why you use funcitons
idiot
those are literally the same without function
even logner to write down
nvm
what is even going on here
this guy is trolling
fr
making functions for existing functions
making it longer
i cant understand the point behind it
2 digit iq's
shit
feels like the next level code
people when you tell them to learn java instead of making the worlds best most unique plugin first
you tried to read english before learning english
public class Click implements Listener {
@EventHandler
public void onSoupClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
// this is shit p.sendMessage(p.getItemInHand().toString());
if (!p.getItemInHand().getType().equals(Material.SOUP)) { return;
}
p.getItemInHand().setType(Material.BOWL);
p.setFoodLevel(20);
p.setSaturation(20);
p.setHealth(p.getHealth + 8);
}
here
it will work
100%
just tested
go test and learn java
never come ack here
before you learn java
not trying to begin rude
but man you are more annoying then the neighboor dogs
not sure what is Saturation or foodlevel
yeah guys its his code
never used those 2
but it added health
thats my full code, i had to use the checkitem function 2 times here
and change SOUP Material
thats why i needed that funciton
nah man
bukkit tutorial moment
his code be like find whats wrong in this code
i needed to check if its not above max health because it FUCKING ERRORS
IM NOT USING 1.19
im using 1.7.10
good for you
Too old! (Click the link to get the exact time)
pretty sure the click on the sign would be detected by the event anyway making the function redundant
anyone got a util func to add lore efficiently :p
Did you tried CTRL+Click on the methods ? You'll see where is the difference
if he does such a question on stackoverflow he gets banned 💀
fr fr fr
eclipse 😮
or different IDE?
i have a friend who uses eclipse like for 15 years its fine
Outch, no worries, maybe have a look at javadoc
probably googling for stuff in netscape, too
this thing is stone age
fr
either its not that bad
i have a friend
who codes from his mobile
without An IDE 💀
editing txt files
lmao
what i said wasnt a joke he actually made a plugin
I have exams paper based 🙂
;l
most people do. Same for me but I'm done with my degree^^
💀
is there any event when the entity freezes/unfreeze?
wdym by freezing? its movement gettin blocked?
no but there is .isFrozen()
the snow freezing
I assume being in the special snow
Eclipse🤢
ah idk im not familiar with new apis
they're not looking to freeze people bruh..
Eclipse is nice - I cannot understand the hate
I love eclipse it's my favorite and only ide
It certainly isn't the best, but not the worst
Have a scheduler that have a map checking if the player state has changed
I think eclipse is ok. I also swapped to intellij. I prefer the git change marking of eclipse tho
Any IA completer better than Tabnine?
Because copilot expired, and tabnine its a mess
No, he's trying to make a ripoff soup pvp
and in soup pvp u heal by right clicking soup
even if ur not hungry
I need some help implementing the WorldEdit API to my VSCode spigot project
Someon experience with implementing the WorldEdit API?
Currently using the command executor, but that is everything but the plan.
Sorry but why VSCode ?
I am used to working with VSCode lol
You reccon I go back to eclipse?
I did that 5 years ago and just started picking up plugin development again.
Noo stay with VSCode
Well you'll have to refer to WE javadoc
And if you need help with it you should probably reach them
To import the plugin just add it to the pom
Show us how you tried tl implement it
That's what I tried..
I just deleted it all lol
wait got it back
Failed to read artifact descriptor
For long codes please use
?paste
any idea @agile anvil ? 🙂
You should use paste for long codes and then describe the problem + link
Please dont ping them, they will answer when they can
Thanks
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
...
...
i have server, do you want ti join
Why are you pinging me? That was in February…
I am getting the error on the pom.xml itself Evan, so there is something wrong with those dependencies.
Np 😆
remove them
add libraries
...
as worldedit.worldguard as library
it seems fine to me
just go for manual way.
How would you reccon to add libraries to vscode, the maven way seems to be the only 1 recommended.
😭 ant
Someone's gotta keep Apache alive
Who needs easy access to documentation when you have ant
manually
learn to use visual studio
its so essential
Everything else is fine, just need to get this shitty worledit into the code.
and learn java as well
maven vs gradle guys
Yeah but you can install them locally to m2 and then access it from any project
Back in the days you just added the path from the java extensions and you where done.
?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!
bruh
SELECT T " +
"FROM G WHERE X < (?) AND X > (?) AND Y < (?) AND Y > (?) AND Z < (?) AND Z > (?) AND PLAYERNAME = (?) AND ORDER BY T ASC LIMIT 1;")) {
whats wrong here
the problem appears after i added ORDER BY T ASC LIMIT 1
learn java
u didnt instalize it
this stacktrace literally tells you the problem
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
bump ~ the command is fine but "ORDER BY T ASC LIMIT 1< is not working
in general
I cant just slap the worldedit jar into the project folder by any change?
not gonna even try to help u
you dont know how to use your own IDE
I don't think that is what is going on right now, but sure you do you 🙂
what's the easiest way of adding text to a .yml
Typing it.
Sorry that was 2 easy.
Probably just creating a New File instance of the .yml file and adding strings 🙂
I've got the file instance, how do I add strings tho
A no wait
BufferedWriter I believe it is called with Java
It creates an apend of the file and allows you to add text 🙂
output = new BufferedWriter(new FileWriter(my_file_name, true));
output.append("New Line!");
output.close();```
This adds the line "New Line!" for example.
Or just use the yaml configuration api
o okay thanks a lot
Don't forget to close that FileWriter
doesnt closing the buf writer closes the internal writer?
Yeah it does.
i didnt know either cuz i never use that shit lol
This should work as an library reference for jar files right: "java.project.referencedLibraries": "lib/*.jar"
?
Put it into the settings,json
vscode
I highly recommend using a java IDE like Intellij
also you should use maven or gradle. It should take care of the dependencies for you
I know, but it wasn't working lol
Sounds like a good reason not use vscode for Java
hmm
I found another maven URL
Errors are gone..
Nevermind
Got no bloody clue
If you want to code in Java dont use vscode
Yeah starting to realize that
Because its like using a fitito for doing racers
It was so much easier I code everything in VS
Na
Do you guys prefer Intellij or Eclipse?
Na
Eclipse
eclipse is fine too
C++ and C# != JAva
Thanks you for your opinion Evan
😂
I use VSCode for, python, C# and webdevelopment.
alex
In my case i dont like oddie things so i just intellij idea ultimate versions
Oh shit
not matter what platform he go
And instead of helping you just keep bitching 🙂
if he doesnt know how to light up the gas in the kitchen
he cant cook
FUCKING BASTARD GOOGLE IT
its so simple
learn to use your IDE
then ask for help
nah im fine
i just like to get muted for an hour
lol
Verno legit if someone asks it in different forum
he would get banned
Gladly I haven't been googling for the past 2 hours
waitin few mins
It also make me annoyed people who use eclipse in 2022 when you have a fully free jetbrains version
Wish I came up with that idea
idk eclipse is fine
i have an friend who uses it
i personally dont like eclipse
and he is decent guy
now you know the secret
watch few guides on how to use VS
or read some articles
You know that was sarcasm right?
Google your question before asking it:
https://www.google.com/
anyone knows how i can transform '1' to the int 1
(int) character gives me an int value which is 48 too high so i might just do (int) character - 48
number / number = 1
Integer.valueOf
or that
printing 49 System.out.println(Integer.valueOf('1'));
its an integer in char form
so '1' should give 1 as int
myes System.out.println(Integer.valueOf(String.valueOf('1'))); works but wtf
yup just tried it too
Meant this method mb https://docs.oracle.com/javase/8/docs/api/java/lang/Character.html#getNumericValue-char- not exactly sure if this is it though I haven't used it in a while
yeah that should be it
that gets ascii value
what i expected
#1012313792488681492 if someone is brain enough
just do
Integer.valueOf("1")
lol
i said its a char not a string
yikes
and?
eclipse is perfectly okay
why is it ass?
being a year long eclipse user
eclipse looks like a program from prev century
idk I can't even describe it, ij is just so smooth
that sounds like what a linux user would say
maven integration for eclipse is bad too
I don't like that intellij only marks files as changed (git) when it's visible. Eclipse also colors the folders containing changed files. Besides that I like intellij more
ij is a lot slower than eclipse, and the ui is barely better
'barely' lmfao
eclipse ui isn't that bad
it's a different style
it's a lot slower than what it used to be
slow?
yes kinda
and intellij is barely being updated now
eating ram thats the only thing
can't really say a lot about that, been only using ij for half a year now
its been more than a year since the last update
on low end devices it's not fun'
i mean my ui is pretty
thats not the problem here
because it is indeed kinda slow. You won't notice it on normal minecraft plugins but at huge company projects with a lot of dependencies etc it can take a while to be ready
Character#getNumericValue(char) 🧠
respect for how few icons you have in your taskbar
it is indeed slow
HAh
i make some projects with a shit ton of dependencies in gradle
mye seems to work thank you
there isn't a way to make intellij also color changed folders instead of only the files inside, right?
might be true, as far as it goes for me I don't see nothing of that, might be the m2 ssd I have it on
the slower speed is a worthy trade-off for the significantly improved autocompletions etc
^^
^^^
i coded in notepad++
agreed
die
I open any application with search
how do yall manage dealing with offline players for example in a moderation plugin?
not buttons
well workflow benefits
i memorized all the methods and imports for the libraries i use
microsoft rich text format is the best IDE
you store player uuid's, but how are you meant to get the uuid of a player that isnt online
offlineplayer uuid?
you get it from offline player
Bukkit.getOfflinePlayer(name).getUniqueId()
wordpad
getOfflinePlayer(name) is deprecated
might evolve mojang server lookup
and?
its not for removal
paint text
mm ok i guess