#help-development
1 messages ยท Page 1698 of 1
That comment
use saveDefaultConfig(). the other line does absolutely nothing
๐ฌ
?stash
i am making a lobby selector plugin, can someone help me what do i do to send players to another server?
Where do I compare?
@EventHandler
public void onDeath(PlayerRespawnEvent e){
Player player = e.getPlayer();
for(String locationName : locationsData.getCustomConfig().getKeys(false)) {
if (player.getLocation().getWorld() == locationsData.getCustomConfig().get(locationName + ".world")){
double x = locationsData.getCustomConfig().getDouble(locationName + ".x");
double y = locationsData.getCustomConfig().getDouble(locationName + ".y");
double z = locationsData.getCustomConfig().getDouble(locationName + ".z");
Location location = new Location((World) locationsData.getCustomConfig().get(locationName + ".world"), x, y, z);
player.getLocation().distance(location);```
I only come to this, I think I can use the locationsData to make a temp section, but I dont like that, do you have any other ways?
hmmm i just add another for loop, let me see if i can compare that way
getConfig().set("path", location);
loc = getConfig().getLocation("path");```
heh
heh?!?!?!?!?!?
very good :Vvvv
thats how you save and load locations in a config
yes... that plugin i used as an example too old...
i need to replace those lol
thanks lol this actually reduce alot of spaces
how about just getdata.set(args[0], player.getLocation())
does anyone know how to register a fake cosmetic glow enchant
in 1.17.1
my old method broke and i rely on it pretty heavily
i wonder if we can use this?
public boolean onCommand(@NotNull CommandSender sender, Command cmd, @NotNull String label, String[] args) {
FileConfiguration getdata = getConfig();
if (cmd.getName().equalsIgnoreCase("spawnset") && args.length == 1 && sender instanceof Player player) {
Location playerloc = player.getLocation();
String locationName = args[0];
getdata.set(locationName, playerloc);
return true;
}
if (cmd.getName().equalsIgnoreCase("spawnremove") && args.length == 1 && sender instanceof Player player) {
String locationName = args[0];
if (getdata.contains(locationName)) {
getdata.set(locationName, null);
} else {
player.sendMessage(getConfig().getString("messages"));
}
return true;
}
return false;
}```
instead of register the command
i use the cmd.getname
I'm creating a MySQL connection with this jdbc string, but the connection still causes EOFException (Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.) when the connection timeouts. Am I doing something wrong?
jdbc:mysql://" + getConfig().getString("Database.Hostname") + "/" + getConfig().getString("Database.Database") + "?user=" + getConfig().getString("Database.Username") + "&password=" + getConfig().getString("Database.Password") + "&autoReconnect=true
// * Registers custom enchant to add glowing affect to items
public static GlowingEnchant glow = null;
public static void registerGlowEnchant() {
if(glow == null && !isLegacy()) {
glow = new GlowingEnchant(new NamespacedKey(Core.getInstance(), "GlowingEnchant"));
if(Enchantment.getByKey(new NamespacedKey(Core.getInstance(), "GlowingEnchant")) != null) return;
try {
Field f = Enchantment.class.getDeclaredField("acceptingNew");
f.setAccessible(true);
f.set(null, true);
Enchantment.registerEnchantment(glow);
} catch (Exception e){
e.printStackTrace();
}
}
}
public class GlowingEnchant extends Enchantment {
public GlowingEnchant(NamespacedKey id) {
super(id);
}
@Override public boolean canEnchantItem(ItemStack arg0) { return false; }
@Override public boolean conflictsWith(Enchantment arg0) { return false; }
@Override public EnchantmentTarget getItemTarget() { return null; }
@Override public int getMaxLevel() { return 0; }
@Override public String getName() { return null; }
@Override public int getStartLevel() { return 0; }
@Override public boolean isCursed() { return false; }
@Override public boolean isTreasure() { return false; }
}
ty
np
Anyone know how to stop the ender dragon from spawning (And stopping the boss battle from being created) without spawning a portal?
I've tried setting any variable that the dragon checks for to true so it doesn't spawn but it always does no matter what. (Unless there is a portal in the world.)
I've tried these so far.
WorldServer ws = ((CraftWorld) w).getHandle();
((CraftWorld) w).getEnderDragonBattle().generateEndPortal(false);
final Field field = ws.getClass().getDeclaredField("dragonBattle");
field.setAccessible(true);
Field modField = Field.class.getDeclaredField("modifiers");
modField.setAccessible(true);
modField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(ws.getDimensionManager(), null);
ConsoleOutput.debug(ws.getDimensionManager().isCreateDragonBattle()+"");
/*final Field field = ws.getDimensionManager().getClass().getDeclaredField("createDragonBattle");
field.setAccessible(true);
Field modField = Field.class.getDeclaredField("modifiers");
modField.setAccessible(true);
modField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(ws.getDimensionManager(), false);
ConsoleOutput.debug(ws.getDimensionManager().isCreateDragonBattle()+"");
Field prevKilled = ((CraftWorld) w).getHandle().getMinecraftWorld().getDragonBattle().getClass().getDeclaredField("previouslyKilled");
prevKilled.setAccessible(true);
prevKilled.set(((CraftWorld) w).getHandle().getMinecraftWorld().getDragonBattle(), true);
ConsoleOutput.debug(prevKilled.get(((CraftWorld) w).getHandle().getMinecraftWorld().getDragonBattle())+"");*/
just kill the ender dragon
Have you tried setting this to zero? private static final int GATEWAY_COUNT = 20;
DragonBattle#i() is the method that decides if the dragon has been killed
Battle still occurs and spawns portal.
yep, its method i() that counts portal blocks
Haven't yet what does it run?
ignore that comment. no use
What's its return type? I'm not on PC right now.
I'll look into it when I get on PC. Thx.
Bukkit.getWorlds().forEach(world -> {
try {
final var level = ((CraftWorld) world).getHandle();
final var dragonFightField = level.getClass().getDeclaredField("dragonFight");
dragonFightField.setAccessible(true);
dragonFightField.set(level, null);
} catch (final ReflectiveOperationException exception) {
exception.printStackTrace();
}
});
worked perfectly fine for me
o.O
I am chilling in the end right now
no enderdragon or portal in sight
I'll try that too thx.
papers latest xD
but /shrug
concerning that a majority of servers run paper anyway, that does not matter
I don't run paper
I will when I get on PC lol
tho idk what your code is even doing. field.set(ws.getDimensionManager(), null); why call the dimension manager when you are getting the field from the WorldServer class
surprised that doesn't error you out
I was trying everything lol
Try leaving the world a few times btw. I've had it take 3+ times to spawn the dragon on some of my tests
I did xD 5 times in and /kill and still no dragon
Paper > Spigot
๐
Paper doesn't exist without spigot ;) (same goes with spigot and bukkit and so on)
Doesn't mean paper is either.
Well, Paper has pretty much the same functionality of Spigot but the API has changes which I prefer to favor over
anyways imma not argue about this
What do people use to store simple .yml-s in data folder? I need to store data of uuid + region name (string)
spigot configuration API usually
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
basically
but instead of the plugin configuration (which is the config.yml file) they use custom files
@ancient plank
I need help
I can't use bungecord latest version
U download latest but keep saying outdated
Why
Help
dont ping staff for help with server/dev stuff
Why am i getting error: the left side of an assignment must be a variable
https://i.imgur.com/RhTIQnf.png
there is nothing in that SS that would give that error
Ayo
But wait
I wanna trigger a primed tnt if player didn't move for 5 sec, if he moves I wanna do nothing
Heo could I do that
How many blocks are in your blocks?
Whats the best way to check if there is a Water source in a specific range of Blocks around the Player?
What else is needed to listen to API event? I have this:
@EventHandler
public static void onPreBuyEvent(PreBuyEvent pbe)
{
//Something has been rented, store it in our yaml database.
String buyerUUID = pbe.getBuyer().toString();
String regionRentedName = pbe.getRegion().getRegion().getId();
rentDataConfig.addDefault(buyerUUID, regionRentedName);
rentDataConfig.save();
rentDataConfig.reload();
}
But it doesnt get triggered/called it seems, any ideas? I reviewed both plugin API side and my own code and it seems to be something wrong with my code
remove static
as fast as possible, between 0-30 Blocks radius, depends on how often the player is using it but max should be once ore maybe twice a second
if the listener is correctly registered and the event exists
That demand is VERY heavy. its going to lag the server
All I did was put @eventhandler ting
okay and whats about only once every 10 seconds on max?
google "spigot how to register a listener"
Ok checking
oh wait
Yeah ok something like this, thanks
getServer().getPluginManager().registerEvents(new MyListener(), this);
okay and whats about only once every 10 seconds on max?
Get chunk/s snapshot loop async ghrough each block close to player
Do you have an example of that?
Not home rn so nope
okay
Yeah looks like a paper only field.
java.lang.NoSuchFieldException: dragonFight
Yeah its suppose to be dragonBattle but like I showed above doesn't work either.
you are on latest right
Yeap
I'm looking through the server jar right now. Ill let you know if the variable is different
private final EnderDragonBattle dragonFight; is literally a variable on the WorldServer class
idk to what that gets obfuscated
you do realize spigot is obfuscated in 1.17
its going to be some shitty single/double char name
what do you mean ''blocks in your blocks''
The object (class) won't be a different name the variable might be though
Guys what happened to the package view on the jdocs
they are quite annoying to browse now
?
https://hub.spigotmc.org/javadocs/spigot/ still has the packages
Yeah found it lol. Thank you.
did it work out
No it does not show the package tree list
It does?
Ran into issues with my world loader and teleport commands xD
rip xD
Oh come on mojang why the fuck did you put the functional code bit i need to modify in the WHILE!
:reee:
No field not found error though so ๐
sweet, yeah let me know if it worked on spigot
Guys i got this error what is the problem ?, i clone projects from github and i cant run projects.
Believe you have to import it as an eclipse project
Have you tried clicking the green run button on the left side
but before i uploaded projects to github with eclipse. Now i cant clon them into intellij ?
sorry my english btw
Ummm so I built against 1.17.1 and now Bukkit.getWorld(key) returns null... But the file exists...
I used getWorld(key) to load the world in 1.16.5 xD
Any ideas why this doesn't work in 1.17.1?
It goes on the permission/group plugin
So apparently in 1.17.1 you can't just use Bukkit.getWorld(<WorldName>) to load worlds anymore. You have to use Bukkit.createWorld(new WorldCreator(<WorldName>))
Does the player in the below group has the permission?
Ugggg.... 1.17.1 breaks my void world generator to
Actually it might be because for no reason what so ever I have to make a new worldcreator object to load worlds now.
Everythings right I don't see any issues
we can also roast you if you want
T-T
also a possibility
Nope dragon is still spawning.
rip
Testing again I think the code was in the wrong spot. (The code I had to move because of 1.17.1 BS)
Worked! Let me test it a few more times to be on the safe side lol
eyy sweet
Now if only I can work out why the server randomly holds on saving chunks in a world where the chunks are unloaded xD
List worlds
and see if the world is present
Ooh
Its not. in 1.16.5 it loaded the world from file. In 1.17.1 you have to use world creator to load and/or build the world
Hi, I'm creating and opening (for player) inventory every time, when player types command and I have to cancel InventoryClickEvent only in this inventory. What is the best way to refer to this inventory in the class that has applied InventoryClickEvent listener?
Check if inventory is instance of the inventory you wanted
The easiest way is to check for inventory name, but it's not recommended
But everytime when player typed command, I have to create a new instance of class that opens inventory for him
make it static
what is static ._. and why?
learnjava link here)
?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.
I think
change package name, you have imported the workspace i think right?
HashMap<UUID, Integer>
sure
what is the event for using experience bottles and how to get a player?
Why not just use PlayerInteractEvent and check event.getAction() to see if it is RIGHT_CLICK_AIR or RIGHT_CLICK_BLOCK
Then you can check if the player is holding an experience bottle
the event is called twice if you take a bottle of experience in two hands
Yeah, I've had that issue before, but it's not hard to workaround
How would I check if there is another player the direction the player is looking and if they are in the players range as well as get 5 blocks Infront of the player?
how?
getTargetBlock?
Make a HashSet called playersToIgnoreForXPInteractEvent or something
When the event happens add the player to the set
And schedule a delayed task to remove the player from the map 1 tick later
Then at the very beginning of your event handler you can just do an if statement and check if playersToIgnoreForXPInteractEvent.contains(event.getPlayer() and only run your code if that is false
That name is really long holy
I want to spawn An explosion on a player if the user is looking at that player and if they are in range otherwise spawn a location 5 blocks Infront of the player how would I do that?
You would use a raytrace. I can't remember the exact method but you can do Player#rayTrace or something like that, it returns a RayTraceResult, check if that result.getEntity() is not null and if so check if that result.getEntity() is a player
That's for checking if there is a player
When I enable the anti-xray feature in the paper file, the chunks on the server are loaded too late.
how to fix ?
Clarify what you mean by this
Ask in the Paper Discord
Ok and if there is a player for their location do I do result.getlocation?
Err I can't remember if the raytraceresult has a location, if it does then you can use that
how?
Or just use result.getEntity().getLocation()
If you don't know how to make a HashSet then you probably don't know enough java to be making plugins. Everyone is going to tell you this, you need to learn java before you start trying to make plugins
I did it with the gui, but I don't remember how
Go look at your old code then! 
Vector math.
Get the player's eye location with player.getEyeLocation()
You can get the player's facing vector with player.getLocation().getDirection()
Multiply the direction by 5
then add that to the player's eye location
The code would look something like:
Location location = player.getEyeLocation().add(player.getLocation().getDirection().multiply(5))
I deleted it
Well re-learn some java, lol
Thanks you I appreciate it very much
To create a HashSet is something like Set<Player> nameOfSet = new HashSet<>();
But I'm not going to spoonfeed the entire solution, so you need to learn some basic java stuff for yourself.
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
is there an event for bottles of experience?
Like, throwing them? ProjectileLaunchEvent
Sorry I didn't think of that one earlier.
thanks
do you have this code? I want to see and figure out how to do this
No, I just imagined how I would code what you're asking
entity.setVelocity(plr.getLocation().getDirection().multiply((sidewaysFloat == 0 ? 0 : (sidewaysFloat > 0 ? 0.10 : -0.10))).multiply((forwardFloat == 0 ? 0 : (forwardFloat > 0 ? 0.10 : -0.10))));
Sideways float is >0 when moving left, and <0 when moving right, and for forwardFloat its the same but >0 is forward, etc. How would i be able to set the velocity relative to the players direction without changing the Y
Can you clarify exactly what you're trying to achieve? that message is a bit confusing.
So that the armorstand the player is sitting on goes foreward when hitting w and if the player is looking up it doesnt go up
Understood
When I try to open my gui, I get the problem `openInventory(org.bukkit.entity.HumanEntity) cannot be referenced from static context.
To open:
public boolean onCommand(CommandSender sender, String[] arguments) {
Player.openInventory(gui.openInventory());
return true;
The gui:
public void openInventory(final HumanEntity ent) {
ent.openInventory(inv);
Does anyone know how to fix it?
You would simply get the player's facing direction, zero out the y element, then normalize to make it back into a unit vector
You can't just do Player.openInventory() lol. You have to specify what player instance you want to open the inventory
You're using Player and not the variable you made for player
In this case you would cast your commandsender to a player then call open inventory
((Player)sender).openInventory();
but check first or you'll get errors
Oh yeah sorry, of course
if (sender instanceof Player player) {
player.openInventory(inv);
}
else {
sender.sendMessage(ChatColor.DARK_RED + "This command is for players!");
}
pattern variable ๐
Heheh
That's the pattern variable
what a simpleton
It's valid
my pattern variables are too high level for your redstone repeater mind
its java 16+
Ah ok
its shrek ๐
look up the java features for every update, you'll learn atleast 5 useful things
i love it
Yeah I should do that, thanks :)
If its important to know,
the command to open is separate from the gui class
what if the player moves sideways, also how would i do that?
I get player.getDirection
but idk what after that
Err I don't know how you're getting your inputs as to which way the player is moving
placeholderAPI steeringinput
it works
What exactly does it give you?
Oh right
I usually just rely on IntelliJ going "look, there's new things do it this way dumbass"
fair
That's going to be a little more complicated
I had to do this very recently
Let me grab my code
aight
Why am I shit at designing https://imgur.com/t9YttbV.png
LOL
๐ข
Vector velocity = p.getLocation().getDirection();
velocity.setY(0);
velocity.normalize();
velocity.multiply(forwards);
velocity.add(rightVector.multiply(-sideways));
velocity.normalize();
if (!NumberConversions.isFinite(velocity.getX())) velocity.setX(0);
if (!NumberConversions.isFinite(velocity.getY())) velocity.setY(0);
if (!NumberConversions.isFinite(velocity.getZ())) velocity.setZ(0);```
That should work. The end result is the variable "velocity" which should store a unit vector of which way the player should move.
@somber hull
bet, hold up leme try and shove it in there
Essentially I create a "right vector" using some trigenometry
yall got any suggestion on how I could make it look cleaner
Then I can multiply the forwards (facing) vector by the forwards float, the right vector by the sideways float (but negative bc I got it the wrong way around) and add em together
add more pixels
It's lucky I was making a custom rideable entity a few weeks ago
me?
lol
ye

what do you mean add more pixels?
it was a joke lol
oh
4k images lmao
@urban mirage wait. would i have to set the velocity by multiplying the vecotor?
the images aren't blurry though
They're not blurry but it's pixelated. The edges aren't curved really at all.
yeah
I don't see can you show me?
Just look at your world image, the curves are sharp
Or internet image whatever that is
the border aren't images
huh for me they aren't like that
hold up
its prob the image from imgur
That's from your imgur though, that's just zoomed in.
I can screen share if you want to see it?
I can't right now
@urban mirage would i just change the setY to like -1 if i want the armostand to have gravity buyt not go up while it is being used?
hm ok
ye it works pretty nicely
and what if i want it to go up blocks, like horses?
would i have to check every time it moves if its near a block?
my dumb font renderer sucks ugh
Yeah. I had the same issue and tried to do it like that and it was super messy
Ended up just removing that feature and implementing jumping
lol
if anyone has a solution lmk
auto jump?
((CraftWorld) pastePoint.getWorld()).getHandle().setTypeAndData(new BlockPosition(os.getBlockX(), os.getBlockY(), os.getBlockZ()), m, 2);
I also tried 3, 2 & 1 but block physics are still running for some reason. Ex; sand falling, nether portals breaking etc...
how do i get the block in front of the player, and down 2
again based on the players look direction
fuck it ill just add jumping
yes
https://github.com/esat179/KampJava from here
set the from to the block
like
set pos 1 and 2 to the same block...
@urban mirage what did you do for jumping
mine is more like hovering
velocity.setY((isJump ? (block.getType() == Material.AIR ? -0.50 : 1) : -0.50));
i have this for jumping
I'd do
velocity.setY(armorstand.getVelocity().getY())
The armostand's velocity Y will be the gravitational constant so that should work
oh thats good
Then when it's a jump I just set the Y velocity to 0.4
That's the value that I got from testing which seemed to do a 1 block jump approx
ok..
lmk how that works
lol
it falls but if you hold space it hovers
Anyone got a nice and comprehensive video on how to use and make custom fonts
Check armorstand is on ground first?
is that not how fawe works idk
tru
yea works pretty well ngl
thanks
so, unrelated to what we were doing
but
if i create a object that extends ItemStack
and i then give that "item" to the player
can i later check it with instanceof CustomItem
u got ur answer ?
Thatโs bad
?
yea thats what im asking
so would it work that way?
Like if i create an entity
And make it CustomVehicle
Could i check it later with instanceof?
It may be cloned during the process between you writing to the ItemStack and the time when it actually gets sent into deep nms trees
i assume not but im just checking
Then when you want to retrieve it from letโs say the PlayerInventory youโre in reality getting a CraftItemStack back which has the identical properties to yours
However even so instanceof would fail by then
ok, i thought so
Why not just go with an nbt entry
well i was asking relative for custom cars
if it works with itemstackjs it should work with entitys
Bold assumption, entity and ItemStacks are different in many ways
Cant you just use Block#setType?
lol
is there some way to give an instance of my command classes as parameter? I tried but the instance keeps calling super() and causes a stacktrace
That looks cursed
cannot reference this before super has been called :/
well yea now it requires a boolean but therefore it needed an command class instance
Sounds like rather bad design, whatโs the real thing youโre trying to achieve?
i wanted to set the tabcompleter for the command in the class itself
and let them be registered by the AbstractCommand class
Use this
Operation pasteOperation = holder.createPaste(session, data)
.to(region.getMinimumPoint())
.ignoreAirBlocks(true)
.build();
try {
Operations.complete(pasteOperation);
} catch (WorldEditException e) {
throw new RuntimeException(e);
}
@weary geyser have you tried something like this?
I don't think he's trying to use it in a super call tho
oh yeah nvm
although why are you trying to pass an instance of the command subclass?
Custom models?
to register a tabcompleter but i'm afraid that wont work
and how do i model it?
Well if you already know youโll use the instance itself, why not set it directly in the super class?
blockbench?
I believe you could invoke some other method from holder to create another type of operation?
Then blocks might be specifiable
Or if thatโs done in session ยฏ_(ใ)_/ยฏ
Think itโs a clipboardholder
something like this?
Sure
And then use customModelData in ItemMeta if itโs items you wanna remodel
Hmm maybe yeah
Yup
and let the subclasses override the onTabComplete method iirc
Yup
why entitydeathevent is not working
It is
yep im sure
Also why suppress all
are you very sure?
for custom model data
Thatโs a dangerous move my buddy
can i put any number?
Uh it takes an Integer
why
yes, so can i put any number
or does it have to be specific
all examples i have seen
it's dangerous because then you are unable to see other warnings
are like 90001002
Because you basically dissuade the ide from touching that code and giving you possible hints and feedback
after everything was ok i will put that
Any number above 0 I think
I just go linearly hyper
broadcasting a message doesnt need help right ?
0, 1, 2 and so on
alright
it's kinda redundant to suppress all warnings if there are no warnings
anyways why it doesnt get broadcasted
there is other code below it
He might just wanted to suppress unused
in which case, you do @SuppressWarnings("unused")
Indeed
useless null checks that it could be the guy who configed it problem
12 warns
lets just ignore that
why the event
is not working
No idea
@tardy delta don't roll your eyes at me
If you assert that you register it and that you have the most up-to-date code on the server
Then Idk
there is also no error in console
smh
Could avoid applying block physics and distribute the block placement for more than just a single tick
Letโs say 4 trillion blocks
Why not do that over maybe some seconds?
I think smile wrote a comprehensive guide about it actually
you're going to need to show us more than 4 lines of code
also what warnings are you even getting?
I don't think the compiler warns about unused unless you add a compiler flag or smthn
is it useful to make my plugins instance static other than using it in static methods?
also for an empty tabcomplete (so only player names appear) should i return an Collections.emptyList() or an new ArrayList<>()?
it returns an EmptyList so idk
Is there a way i could develop plugins on mobile? To test plugins i can use geysermc or pojavlauncher, but i have no idea how i develop and build them.
EmptyList is immutable
tablet seems easier
Does the list get updated after it's added to the tabcomplete?
If not, use Collections.emptyList() bc it doesn't require redundant instantiation.
As in, does it add anything to the list?
@Override
protected List<String> tabComplete(@NotNull String[] args) {
if (args.length == 1) {
return StringUtil.copyPartialMatches(args[0], Arrays.asList("help", "accept", "request", "decline"), new ArrayList<>());
}
return Collections.emptyList();
}
(i'm overriding an custom method)
that calls onTabComplete(...) smh
That'll probably work.
bruh
when deathevent gets called ?
when something dies :/
EntityDeathEvent right?
yep
Is it registered and annotated
it is registered
and eventhandler is annotated
@SuppressWarnings("all")
@EventHandler(priority = EventPriority.HIGHEST)
public void onDeath(EntityDeathEvent event) {
Bukkit.broadcastMessage("OK");
remove the priority and try again?
i set the priority cause it was not working ?
add ignoreCancelled=true
in eventhandler
then it wouldnt be executed if cancelled somewhere else?
it would still get called if cancelled
wait what
bukkit is shit at naming things
wait priority highest is called first eh?
the name is so misleading
did not worked
ignoreCancelled stops the method from being called
uuhu
who and why would someone name it that
๐คทโโ๏ธ
it should be inverted
it shoudl be named ignoreIfCancelled
hi, so everytime i try to start up my server with a plugin i made i get this error:
[13:42:13 ERROR]: Could not load 'plugins\SpaceCoreMC-Plugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:178) ~[patched_1.17.1.jar:git-Paper-266]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:160) ~[patched_1.17.1.jar:git-Paper-266]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:410) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:276) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1212) ~[patched_1.17.1.jar:git-Paper-266]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-266]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
could someone help me?
read the error Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
but it has a plugin.yml in it?
no it doesn;t
it does
thats not your jar, and its in the wrong place in your project
how?
my jar is in the com.jonfirexbox.spacecoremc folder and my plugin.yml is in the src folder?
no thats your project
open your jar with 7zip or any compression util.
you will see it has no plugin.yml
so where do i need to put the plugin.yml?
it depends on how you are building
most here use maven, but it looks like you are using InteliJ Artifacts
nothing i showed everything
so i need to make my plugin using Maven?
?
first open yoru jar and confirm it contains no plugin.yml
i checked it doesn't
fix texturepack?
well thats the problem
i have the custom model data
as 123456
on both
and it no worky
wait
wtf
ok, it looked like in your SS the plugin.yml is in the com folder of your project. Is it in the root of src or lower?
you cant set it on both
i did smthng
or wait you can
but i want it to have the custom model...
leme send photos of my path
.minecraft\resourcepacks\testingpack\assets\minecraft\models\item
.minecraft\resourcepacks\testingpack\assets\minecraft\textures\custom
i have texture.png
its in src, but now im making my plugin using Maven
good choice
just be sure you build using the maven menu (right side) and select package
if i do this and there is nothing in the path what does it return?
return new HashSet<>(homesFile.getConfigurationSection("homes." + p.getUniqueId()).getKeys(false));
y model no worky
nah i just turned trhe pack off on accident
its still missing model
ok thanks
lemme look at that tomorrow
Are you making a plugin?
prob not as hes spamming the question
Yeah thought so
guys when i clone a repository from github intellij cant run the projects , who can help me ?
Did you click the run button
4head
my god i can already tell thats some shit...
anyway considering it has a entry point the main.... you should be able to just run it
no have run button
nice fonted button on top called "Run"?
when i press run ->
ye i did
already i did run, but this issue comes ->
add a configuration
why do u have like 10 java projects inside one
I know in eclipse you can have that structure but intellij doesnt allow it unless all of those are submodules
but seems unlikely
I was working with eclipse before, and I had no problem
oh
Intellij => one project at a time
ya
well you are already having everything in 1 class,just make a new project and copy paste
Well first of all, you shouldnt be having like 20 projects in one github repo
is there any ide better than intellij idea?
first upload each one of your projects to a separate github repository
raider
prolly not
F
Intellij is good tho
theyr own premium counterpart
I'd say IntelliJ is the only doable ide for Java imo
https://github.com/esat179/KampJava this is my repository
why you ask?
also eclipse is decent
my edu license boutta run out in a month or two :>
so its all in one projects
Does anyone here have experoence with the plugin qualityarmory?
i cant seem to get a audio effect to work and could really use some assistance
Open Source License
Eclipse has very imbecilic and unorthodox inspections, dont even bring up mspaint ide or netbeans lol
Intellij has free version too
just use community? not much of a difference
Or just do as Pulse said
Get it for free for life
so what should i do ๐
if you develop open source
iโm using ultimate since i can also use php and some other crap
go to eclipse first and foremost
cuz why not
then push each project to their own separate repository
better tools for it?
and also php is cursed
shade you can get a license if you maintain an os software
how?
google it, @spring canyon got it that way iirc
aight
or... use community with a php extension
lmao Matt is here?
nah i prefer the latter
lol yep, believe he rarely visits tho
what do u use php for anyways?
backend?
making random crap on broken edition and web dev ofc
one more question, how can i fix this special characters ?
well there's certainly a lot of options when it comes to backend web dev isnt there
enforce some encoding like utf-8
lol
ty guys for everything ๐
visual studio mostly
yeah for web dev use spring, or express or whatever thing but php ๐
Yes open source license good
with mvc or rest
the one time matt spoke in this discord
the only thing i need rn is a pc
Rare sighting i know
๐ฅฒ
web dev i prefer typescript with react on visual code
i sold mine today
Webstorm though ๐
๐ฎ
instead of โupgrading itโ
or if im on mvc js with cshtml
very smart
?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. Create a thread in case the help channel you are using is already in use!
could someone help?
?paste the code
also paste the error next time thx
It's beautiful ๐
oh sorry, also what code
you are passing a gui class to a command wut?
oh thats not your plugin?
php looks like Javaxjavascript

the poor inbred abomination resulting of those 2
it is my plugin
then send the code ?
but what code? the java code?
Yes, what else?
well im not sure i have never made a plugin before this is my first time so i don't know
I did wit module system , its should be okay ? Now projects works perfectly
i mean tbh packages are better
Ig thats one way to handle it
but if you're learning i dont think it matters
https://paste.md-5.net/icihigipim.java here is the code
pog
LOL
bit of a stupid question, but how do i turn a List<String> into a string with a newline between each item
final String joinedString = String.join(System.lineSeparator(), list);
note, replace the sys.lineseperator with "\n" if you always need \n
or
String joinedString = list.stream().collect(Collectors.joining(System.lineSeperator());
this better though
i just like streams
might as well share one
this works with any char in place of System.lineSeparator() right
๐
how do i make an item spin on top of a block like spin in a circle
spoon feed me
๐ฅบ๐ฅบ
๐ฅ๐ฅ
don't items rotate on the client side by default xD
Not that
else I guess it is an armor stand with the item in their helmet slot
like spin in a circle
tryna mess with crates so far i made so many animations for no reason
been thinking of that method for a while now
Isnt that just the default behavior of items?
idk where to start
.
most likely armor stand then
put the item into the helmet slot of the armor stand
and teleport it around
yeah ik there is armor stand included
the teleport around thing is what im looking for
I mean, like 7th grade math on how to calculate points on a circle using sin and cos waves
yeah thatโs the thing i have a way too decent memory
Get a fixed point (Location). Get a Vector of length N.
Teleport the as to fixed point + vector then rotate vector by Y degrees and repeat.
ty
oh right, vectors have rotate methods now
You dont need to do the math for that. Spigot just lets you rotate a vector around an axis.
expensive as fuck compared to a straight forward sin and cos combination
actually I lied
I dont think you can just get a way with a loop. Mabye for pre-calculating the points. But a scheduler is def needed here.
the y axis does not use the general 3d transformation matrix
i guess we have to try it
ty guys
np, the rotation might actually work a bit easier in terms of a scheduled timer
Hi, I'm trying to use the Configuration class of the bungee API, to retrieve data from config.yml. But I'm not 100% sure about how to use it correctly
Commands:
discord:
command: /discord
types:
- TEXT
text:
- 'Click here to join our Discord server!'
hover:
- 'discordlink'
link: 'discordlink'
What would be method to retrieve the "discord" parameter, and all it's internal details?
Been coding too long with non-strict languages. Now I'm struggling ๐
why is .getItemInHand and .getDisplayName deprecated?
So I am trying to create a corpse following this tutorial (https://youtu.be/6LSScMdk0gU)
and it does not work it throws no errors but when i die ingame it does printout 2 console messages
so I think the problem is on the PlayerDamageEvent cause its not sending a message when i tell it to
another thing is I made a command to execute the class but no... still does not work on the class I even made sure whenever the class works it displays a message and well nothing happened i have my code down there for the entity
CorpseEntity Code - https://pastebin.com/N3XF41u8
ConsoleMessage - UUID of player ForbiddenBoXOri is 8ec9a87e-4e4f-4fb2-9d66-563329a74f7a
ConsoleMessage - ForbiddenBoXOri[/127.0.0.1:1307] logged in with entity id 335 at ([world]231.5, 69.0, -58.5)
MainClass- https://pastebin.com/HYZws0Eh
hey i have a problem with this, can someone help me?:(
this event doesn't work:
@EventHandler
void onBlockBreak(BlockExplodeEvent e) {
e.setCancelled(true);
}```
you'd have to register your main class as a listener
e.g. registerEvents(this, this)
that was for forbidden btw ^
all the other events are working perfectly
yea
I just register the event
like any other listener
what are you trying to prevent with this
hmm so I made my main implement a listener but "registerEvent" does not seem to be a method
no no
like similar how you are registering the Gui listener
sorry if I wasn't clean enough on that
other people using tnt cannons, i wrote true, but there's a function checking the block position
tnt explosions are entity explosions tho
it isn't the tnt block that explodes
but the entity "primed_tnt"
so that's it
ah so its not the exact command ๐
no xD
then when is called that event?
EntityExplodeEvent ?
nono
so I assume something like this
getServer().getPluginManager().registerEvents(new Listener(), this);```
well, yes but you don't need new Listener() you can just pass this
as this is your instance of your java plugin class which is also already a listener
nono, BlockExplodeEvent
what ?
when is BlockExplodeEvent called :o
oooh i get it
generally when no entity is the cause
getServer().getPluginManager().registerEvents(this); hmm I get an error on 'this' and it says it wants a listener but then my class already implements listener (Main class)
so tnt turn into an entity
thank you^^
Hey got a little problem...
I want to set a list of entity types inside a YamlConfiguration like this:
Set<String> types = getTypes().stream().map(EntityType::toString).collect(Collectors.toSet());
pluginConfig.set("types", types);
Problem looks like this:
types: !!set
SKELETON: null
It's just setting one type and also this strange !!set
Does anyone know why this happens?
You are passing a Set not a List
@eternal night No way your just the best everyone just rejected my question thank u so much you saved a lot of time I can finally sleep (currently 2:02AM)
np xD sleep tight
Oh yea that works, I just notice when I write something to the config my comments are getting removed. Can I avoid that somehow? Like every comment line besides the first one is removed
not easily, only the header can be preserved
alright okay
If I made a constructor for a class and I try to make an instance of the class is there a way to make one without filling in the perimeter it takes?
you'd have to define a new empty constructor for this
k
why is https://pastebin.com/QxLFkQ2w giving me this error Caused by: java.lang.NullPointerException at com.jere.extra.economy.commands.onCommand(commands.java:28) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-786]https://pastebin.com/bQHNzz0s it creates the file but doesnt write anything in it
hey there, i was about to listen to the entityplaceevent, and saw it was deprecated
/**
- Triggered when a entity is created in the world by a player "placing" an item
- on a block.
- <br>
- Note that this event is currently only fired for three specific placements:
- armor stands, minecarts, and end crystals.
- @deprecated draft API
*/
Could anyone tell me what that deprecation means?
what version are you on o.O
1.17
your javadocs are outdated then ๐ https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPlaceEvent.html
ah, that could be
besides that, this deprecation notice is added to new/fresh API
mostly deprecated so the API could potentially be changed after being released first
thank you. Do you know if another event exists for item frame placement?
Because it says its fired for 4 entities, and thats not one of them
kinda weird, i'd totally expect it to be there
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/hanging/HangingPlaceEvent.html is probably what you are after ๐
Hey, which event it's fired whenever player destroys Minecart_chest/hopper.
I can't seems to find any way to obtain minecarts Inventory and loot that's being dropped.
np!
You'll need to provide the full file with the correct line numbers. i also suggest updating your java so you get clearer exceptions
not sure what you mean? but line 28 is wrp.set("Name", args[1]);
maybe I should just become a professional javadoc linker
wrp or args[1] is null then
definitely
args[1] is set
then wrp is null
wrong one 1 second
how is it null Economy1.apiCreateFile(args[1]); Economy1.apiGetFile(args[1]).createSection(args[1]); ConfigurationSection wrp = Economy1.apiGetFile(args[1]).getConfigurationSection(args[1]); i set it here?
totally its a blessing ๐
getConfigurationSection is technically nullable
The configurationsection may not exist, api.getFile(args[1]) may be giving you null etc
Doesn't seems to be firing VehicleDestroyEvent tho
yeah i know, im saying how is it null though when i set it there...
are you certain. it should get triggered for every minecart
e.g. validate you are actually registering the listener etc
Entirely certain.
public void test3(VehicleDestroyEvent e){
System.out.println("vehicle Event");
System.out.println(e.getVehicle());
System.out.println(e.getAttacker());
}```
[23:21:19 INFO]: Pickup Event
[23:21:19 INFO]: Pickup Event
[23:21:19 INFO]: Pickup Event
[23:21:19 INFO]: Pickup Event
[23:21:22 INFO]: Entity Damage Event
[23:21:22 INFO]: Entity Damage Event
[23:21:23 INFO]: Entity Damage Event
[23:21:23 INFO]: Entity Damage Event
[23:21:27 INFO]: Entity Drop Item Event
[23:21:27 INFO]: MINECART_CHEST
[23:21:27 INFO]: ItemStack{MINECART x 1}
[23:21:27 INFO]: passed
[23:21:27 INFO]: Entity Drop Item Event
[23:21:27 INFO]: MINECART_CHEST
[23:21:27 INFO]: ItemStack{CHEST x 1}
[23:21:27 INFO]: passed
[23:21:28 INFO]: Entity Damage Event
[23:21:29 INFO]: Entity Damage Event
Unless i'm blind
It doesn't exist in my list
Economy.apiGetFile(args[1]) may be yielding two different objects?
Try saving the first economy.getFile variable and then using it for the second method
Other than that, i'm not sure, i don't use the normal spigot configuration system, kinda built my own because of some limitations it had
where is the event handler annotation ?
i dont think so args[1] is literally just for the name of the file
Oh okay nvm not certain xD
xD
I miss-copied it
Either way. How do i obtain Inventory of the Entity
That's being dropped
check if the entity is an instanceOf the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/minecart/StorageMinecart.html interface
declaration: package: org.bukkit.entity.minecart, interface: StorageMinecart
then cast it to that interface and you can access the container
Great it works. Thank you
you wouldn't, thats pointless
how could i use something like player.chat but using the chat components?
then thats a different question. I'd still nto use fawe
You probably want to look at 7smile7's resource on task timing
took a sec to find it
fawe is going be no faster
fawe doesn't actually replace blocks async
it uses a queue and jumps back sync to place
hey just real quick
how do i set velocity of a particle
i.e; if i want smoke blowing east, etc.
Nope, I don;t use fawe
isnt fawe really bad compared to worldedit
It was great back in 1.12
h
guys
how to make sure that the experience does not fall out of the experience bottle?
idk if theres an easier way, but check if theres any exp orbs (entities) in near of the position where the bottle exploded
And if theres, delete them
@EventHandler
private void on(BlockBreakEvent event) {
int exp = event.getExpToDrop();
if (exp > 0) {
event.setExpToDrop(0);
}
}
how bottles?
Has anyone worked with making custom recipes for an anvil before?
Mine takes all of the items you put in and only gives you one of the output
if (inventory.containsAtLeast(new ItemStack(Material.GOLD_INGOT), 1) && inventory.containsAtLeast(new ItemStack(Material.SOUL_SAND), 1)) {
inventory.setRepairCost(10);
event.setResult(ItemStack);
}
It makes sense that it does, but is there any way to stop it from doing that?
You would have to mess with the anvil event to put the items back
There seems to be some issue with colored displaynames being seen right
When I try to find this item in an event it doesn't "see it"
ItemStack sv = new ItemStack(Material.GLASS_BOTTLE);
ItemMeta svMeta = sv.getItemMeta();
sv.setAmount(1);
sv.addUnsafeEnchantment(Enchantment.LUCK, 1);
svMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&5Soul Vial"));
svMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
sv.setItemMeta(svMeta);
I'm pretty sure it's an issue with the naming because just checking the enchant, flags, and material works
How are you looking for it
if (inventory.getItemInMainHand().getItemStack().isSimilar(myItemStack)
And myItemStack is identical?
Yes
I forgot to say it before, but searching by the enchantment, hide enchantments flag, and material all at once works
i dont think so?
custom model no worky
plese help
lmk any information you need
its working now
How can I get the charges of a respawn anchor that has exploded? I've tried BlockExplodeEvent, which returns air as the block, and PlayerInteractEvent, which doesn't return the clicked block at all and throws an error: java.lang.NullPointerException: Cannot invoke "org.bukkit.block.Block.getType()" because the return value of "org.bukkit.event.player.PlayerInteractEvent.getClickedBlock()" is null. Is there any way around this other than storing the location and charge of every placed respawn anchor?
still have no idea why this dont work
what doesn't work about it?
did you saveConfig()?
a normal day, dont worry.
perhaps you registered two events
accidentally created two event classes
if they are two of the same class, yes
?paste your full event method