#help-development
1 messages · Page 288 of 1
See how confusing it is? Use proper names
Look I got your problem, I'm sorry. It's not confusing for me so I'll change it next time I ask something
The entity that is targeted or the entity that you are getting the target from?
Alright?
I want to be annoying so you do it better next time :p
XD
You‘ll be the same in 2 years
Thanks, you too my fruity friend
Anyway, sorry, did you get it fixed meanwhile? Im only on the phone rn and its hard to read stacktraces or code on this tiny screen
The raytrace method returns null when there‘s no hit at all
hello, i need a little bit of help with shading maven dependencies! somebody can help me please?
@last temple Can u be my cat?
if i am using .sendBlockChange to send client block changes to players will it still send to a user even if it is outside their render distance? and if it does get sent and is in an unloaded chunk does the block show when they load the chunk?
?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!
Okok
Am I allowed to send images here to better explanation?
Imma try so I don’t wait answers
sure
Thanks
I'm getting used to this Shading maven dependencies, I'm trying to adapt a plugin to Velocity and this platform doesn't have the com.mysql.jdbc.Driver, so it started my journey. To not make a paragraph, i'll be direct. I learned how to do it, but not in the place I want. For example, SkinsRestorer have their shaded dependencias inside of its META-INF, and I wanna do that, but the dependencies just appears like it is my code
https://blog.jeff-media.com/common-maven-questions/ maybe the second part of this blog post might help you
this is SkinsRestorer
ugh that doesn't look right
and this is mine
these packages of com.google and all just adds like it were my code, and it is not and looks bad, so i wanna "exclude it" as SR does
i dont know if im explaining well
you can safely ignore the META-INF folder, nobody cares about that. it just includes a few pom files
Is there anything wrong outside of the META-INF directory?
and this is the maven plugin that im using
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>maven-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>```
why do you need the assembly plugin?
just those packages of com.google that i wanna disappear u.u
I dont know, it worked like that
you should use the shade plugin instead
delete the assembly plugin, and use maven-shade-plugin. check the blog post I sent abobve
ok!
here ^
maven assembly is primarily if you want to make war files or uber jars
an ubjer jar is where it contains more jar files itself and not the actual classes of the dependencies which is what shade plugin is for
while technically you can do the same thing with assembly plugin or similar should say as what shade does they are both different in how they do it.
in 99% of cases, you wanna use shade instead of assembly
^
not a lot of help, I have supposed it but now I know I was right, actually i have like 6 depencies in provided, the ones that I'm telling you I need them in my jar, but i dont want them to appear like part of my code because looks bad
that's why I want to make it like SR
t.t
the problem with doing it that way in regards to spigot is that you would need to extract them from the jar and then have your own loader for classes
shade is fine and you can relocate class files to be in their own packages if they come from dependencies
in fact, the default is to put them in their own packages as they are in the dependencies, but should relocate in case someone else has same dependencies in their plugin so that you don't get a class path conflict going on
which is probably something you didn't think about
actually no
so, you recommend to leave my idea and doing it normal way but other package names?
so it is more easier and less problems?
in the event a class path conflict happens, java takes which ever was the first and ignores the others. in this scenario this means an older dependency version class can be on the path that isn't compatible with your plugin
so to resolve that you relocate the classes of dependencies to be in a different package but clearly marked as not being yours 🙂
idk what your idea is or why you have an issue with the way it is normally done
if you don't want those classes to show up in your jar like all the other classes there are other ways you can do it, just they are more work to do so then what anyone else really cares about. Developers don't look at your jar and go hmmm they are copying another projects class files
instead they just see, ah they shade in dependencies
it is more further to see that if they are able to see your maven pom file
imma translate so i can understand better, wait
okok!
I know it is "dumb" that someone want to do this, but personally it would have looked more, like, beautiful? ajajsad
but no one is going to look at it except possibly other developers. Users typically don't care and if you have a user that is looking inside of the jar it is probably because they want to edit the plugin.yml jar
Whut
otherwise there is literally no other useful thing for the user to do so
ok!
i do do that!
they wanted it to look organized, which there is no benefit of doing so nor is there people really caring how the final product structure looks lol
You can always relocate shaded stuff
exception being if you are making an API
Eg my.package.libs.com.google…
i now want them to be like "shaded.com.mysql . .. ", so it could be like this?
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>shade</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<relocations>
<relocation>
<pattern>com.mysql</pattern>
<shadedPattern>shaded</shadedPattern>
</relocation>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>shaded</shadedPattern>
</relocation>
<relocation>
<pattern>google.protobuf</pattern>
<shadedPattern>shaded</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>```
Naaah
Do not just use „shaded“
Use your.packagename.shaded
did you know with the shade plugin you can provide both a shaded jar and a non-shaded one?
only benefit of providing a non-shaded one is for API's really
so, like this then?
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>shade</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<relocations>
<relocation>
<pattern>com.mysql</pattern>
<shadedPattern>com.ticocraft.ticodisguise.shaded</shadedPattern>
</relocation>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>com.ticocraft.ticodisguise.shaded</shadedPattern>
</relocation>
<relocation>
<pattern>google.protobuf</pattern>
<shadedPattern>com.ticocraft.ticodisguise.shaded</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>```
i dont get this
sorry
it worked!111!!!
is it good like that?
RegisteredServiceProvider<Economy> rspEcon = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if(rspEcon != null) econ = rspEcon.getProvider();```
i'm having an issue with this. rspEcon isn't null but throws an error relating to the econ plugin. Vault is loaded in but the Economy plugin isn't loaded yet. how do i make it detect the economy plugin but after its loaded
private static Economy econ = null;
/**
*
* Sets up the Economy provider from vault
* for use within the plugin
*
*/
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
public Economy getEcon() {
return econ;
}
That's what I have.
I had something similiar and it didn't work before
i think i need to create an economy manager
An alternative can be doing a runnable in onEnable, these runs when onEnable ends, so it’s enough time to load that plugin
That's the way it tells you to do it in the vaultapi
its being ran in onenable
the econ i have hooks into vault but its null until it finishes loading
so i see the econ loaded in but it throws a null error for TheNewEconomy being null
Use the one that's on their github as it's the proper way you need to do it.
I tried that one first and it didn't work
I am loading a world while my server is running, but it takes too long to load and everyone times out. Do you guys have any suggestions on how to prevent this?
So i've been chasing the rabbit
It's what I've got an it works fine. Do you have an economy plugin installed.
Yes, the one I mentioned above TheNewEconomy
It loads in but its null until after all other plugins load in and then it finishes loading
I just used this and econ is null
Using Vault and https://www.spigotmc.org/resources/the-new-economy.7805/
Hmmm still null with another econ plugin
what's weird is in my main file it works but when i use .getEcon() its null
there's also this
Caused by: java.lang.NullPointerException: Cannot invoke "net.milkbowl.vault.economy.Economy.getBalance(org.bukkit.OfflinePlayer)" because "this.econ" is null
Mine says that too sometimes, but it does work. Try using something like Essentials and see if it works. Might be that Economy plugin you're using
I've tried 2 different plugins and I'm getting this :/
I need it to work because other people could be using these econ plugins with mine
I don't use the Economy.jar I add Vault as a dependency in the build file and add is a softdepend.
Yeah that's what I did
This is the error I get from just using the vault code that was given above (right off their github)
setupPermissions();
if (setupEconomy() ) {
// Econ loaded
getLogger().info("bal: " + econ.getBalance(Bukkit.getOfflinePlayer("7b7de6c2-ac99-4b93-a997-730b451e3c01")));
} else {
getLogger().info("Could not load econ");
}```
I have this with my onenable and it works
but its null when i use .getEcon()
then
econ.getBalance(player);```
throws
``` at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "net.milkbowl.vault.economy.Economy.getBalance(org.bukkit.OfflinePlayer)" because "this.econ" is null
at io.signality.Sleep.SleepManager.doVote(SleepManager.java:101) ~[?:?]
at io.signality.commands.SleepCommand.onCommand(SleepCommand.java:53) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-794]
... 19 more```
in my manager class I do have private final Economy econ = VoteSleep.getEcon(); at the top with all my other loads for that class
oh shit i'm dumb
i figured it out
i had economy loading after my manager class so it was always null
So you got it working?
yeah'
so i recently started a server and put the csgo plugin i can provide link if needed it works with quality armory and for somereason when i start the game and play a few rounds the guns and hands and everything with stop doing damage
can anyone help fix or know a solution to thos? i am thing the spawns are to close and its messing it up but not sure
for something that specific you need to use the dev's support channels. their plugin page should have a discord or something
unfortnutaly i cant find any of the devs socials and cant contact them
whats the plugin
he has a github you can submit problems to https://github.com/SkyHeroes/CSMC/issues
or message him directly on spigot
thank you
chances are very low you'll find someone how knows about that plugin here tbh
How can I add a passenger entity? This doesn't seem to work and when I right click it doesnt say 'import class ...' e.getEntity().addPassenger(Entity.Chicken);
It says cannot resolve symbol 'chicken'. I tried a lot of things but I can't get it to say Chicken without giving me an error
?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.
How?
Google how to spawn an entity spigot
Sorry sir 😏
k got it, thanks
hi guys, how can I move items in certain slot(in gui).
move with a cursor or set items
are you wanting to move items in an inventory by code or listen to people moving items
if you want to know when the player moves the items use InventoryClickEvent, if you want to move stuff from slot 1 to slot 2, get the item in slot 1 using Inventory#getItem(1) and set slot 2 using Inventory#setItem(2, item), with setting slot 1 to air
no no no, I put in slot 1 by cursor(from player inventory), do operations(click buttons) and after it gives modified item to slot 2. And I can claim item from slot 2
yeah listen to inventory click event, get the item from slot 1 and then set slot one to air do your stuff, set slot 2 to your result item
what would be the best way to check whether a player is online or not?
currently im doing Bukkit.getPlayer(args[1]) != null
OfflinePlayer#isOnline
use Bukkit.getOfflinePlayer() instead and use isOnline https://hub.spigotmc.org/javadocs/spigot/org/bukkit/OfflinePlayer.html#isOnline()
declaration: package: org.bukkit, interface: OfflinePlayer
that'd mean using a deprecated method :^(
isonline isnt deprecated?
OfflinePlayer(string) is.
👍
I can`t even grab item
this format better
your cancelling all inventory click events
if you need to be able to drag stuff into the top inventory only cancel clicks from the top inventory
check if https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryClickEvent.html#getClickedInventory() isnt instance of PlayerInventory
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
Did I get it right?
you dont need the slot checks on that, unless your inventory has other items in it
As I understand it, I have to block everything except the player's inventory and these two slots. Yes? Or how?
yeah that should work
Is it a good idea to cache config-data so it you don't have to read it from the conf-file every time?
depends, what i would say is every time you need it in a method set a FileConfiguration var to the config from main then have a reload command that triggers JavaPlugin.reloadConfig which would reload those configs
So it is already cached and there is actually no IO stuff going on?
i dont actually know, i havent had a look at stash for it
thats just what i would say is the better thing to do instead of calling JavaPlugin#getConfig, which would get the most up to date config
EpicEbic
Plugin isnt working in 1.12 too
can i send u logs
?paste them
Yamlconfigs are loaded into memory
How would you do it so if a player presses q to drop the item, it disallows it but if they click q again to confirm it they can drop it?
I would add a ScoreboardTag the first time and check if the player has the tag but I'm sure if there is a better way
In an item drop event or however it's called
?pdc listen to drop item event, add that item to their pdc using https://github.com/JEFF-Media-GbR/MorePersistentDataTypes or just add some data that correlates to that item, if that item is on their pdc drop it
else dont
I have no issue with finding the item. I want to listen for double drop before item actually drops
So a confirmation you want to actually drop the item
cant. it's a command
i dont expect players to lookup uuids 😅
oh well. == null works
the way i said would work, the player attempts to drop the item so it gets added to their pdc if its not already there
if its already there drop the item and remove it from pdc
Yes, thank you
its a view points command.
so /plugin view <name>
if offline, get from sqlite.
if online, get from hashmap
how come
this has probably been asked a million times.... but is there a reason bukkit/spigot-api doesnt expose methods to set stuff like max player count and MOTD?
you can change what the server will tell a client when they request info with ServerListPingEvent, but not the actual information
name is also stored in sqlite. bukkit can get online players by username just fine.
hashmap is uuid, sqlite has both uuid and name
yeah
im aware
doesnt stop other methods being exposed by api like toggling whitelist
this code isnt working i dont know how to fix it:
@EventHandler
public void Break(BlockBreakEvent event) {
if (event.getBlock().getType() == Material.OAK_LOG && event.getPlayer().getGameMode().equals(GameMode.SURVIVAL)) {
int delay = 1;
final Location loc = event.getBlock().getLocation();
final Block block = event.getBlock();
final World world = block.getWorld();
final String stringWorld = world.getName();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(getServer().getPluginManager().getPlugin("Minigame1"), new Runnable() {
@Override
public void run() {
Bukkit.getServer().getWorld(stringWorld).getBlockAt(loc).setType(Material.FIRE);
}
}, delay);
}
}```
pls ping
i want it to replace the block with fire when you break oak log but its not working
changing values with reflections works as an alternative to a no-restart change for MOTD and maxPlayers
id know since id write plugins to bypass Aternos limits
would just be nice to have for something that shouldnt /really/ require reflections just to do
ok new issue
i want to save values of the hashmap to the sqlite db every x seconds. Do I use runTaskTimerAsynchronously or scheduleSyncRepeatingTask? the latter seems to be sync, which doesnt sound good in this scenario
hey does any1 know why this event isnt triggering?
@EventHandler
public void Break(BlockBreakEvent event) {
getLogger().info("1");
if (event.getBlock().getType() == Material.OAK_LOG && event.getPlayer().getGameMode().equals(GameMode.SURVIVAL)) {
getLogger().info("2");
// Clear Drops
Material type = event.getBlock().getType();
Collection<ItemStack> droppedItems = event.getBlock().getDrops();
for (ItemStack stack : droppedItems
) {
event.getPlayer().getInventory().addItem(stack);
}
event.setDropItems(false);
getLogger().info("3");
int delay = 1;
final Location loc = event.getBlock().getLocation();
final Block block = event.getBlock();
final World world = block.getWorld();
final String stringWorld = world.getName();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(getServer().getPluginManager().getPlugin("Minigame1"), new Runnable() {
@Override
public void run() {
Bukkit.getServer().getWorld(stringWorld).getBlockAt(loc).setType(Material.FIRE);
}
}, delay);
getLogger().info("4");
}
}
}```
Did you register it in the onenable.
Why would you save it every x seconds, why not just on write?
its in the main class
is writing it at the same time any value is changed a better idea then?
yeahh
?paste
Did you register the event in the onEnable method in the main class.
https://paste.md-5.net/kikiruzoku.cs - Have I set it out wrong? Guessing I have
how?
Saving ever x seconds seems stupid af, as afaik update statement in sqlite isn't idempotent
It will make much more queries
here is the full thing:
public final class FrictionFire extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
@EventHandler
public void Break(BlockBreakEvent event) {
getLogger().info("1");
if (event.getBlock().getType() == Material.OAK_LOG && event.getPlayer().getGameMode().equals(GameMode.SURVIVAL)) {
getLogger().info("2");
// Clear Drops
Material type = event.getBlock().getType();
Collection<ItemStack> droppedItems = event.getBlock().getDrops();
for (ItemStack stack : droppedItems
) {
event.getPlayer().getInventory().addItem(stack);
}
event.setDropItems(false);
getLogger().info("3");
int delay = 1;
final Location loc = event.getBlock().getLocation();
final Block block = event.getBlock();
final World world = block.getWorld();
final String stringWorld = world.getName();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(getServer().getPluginManager().getPlugin("Minigame1"), new Runnable() {
@Override
public void run() {
Bukkit.getServer().getWorld(stringWorld).getBlockAt(loc).setType(Material.FIRE);
}
}, delay);
getLogger().info("4");
}
}
}```
That is true tho
getServer().getPluginManager().registerEvents(new MyListener(), this);
Thats an example
i get this error:
Firstly I'm on phone so it's impossible to read that error. Secondly. Show how you added it to the onEnable
A little bit iffy cause it will cause the item to be different and not stack
sorry
That's wrong.
this, this
well if they add the item to the players pdc how would the item not stack if the itemstack isnt being modified
Oh player pex
Pdc
I'd recommend moving the event to its own events class. Then just change the new FrictionFire() to that's class name.
Thought u wanted him to add it to the item
ah lol
ok
i was thinking more about creating a list of modifiedKeys xd
but alright cool
thanks
there is any good ways to get empty world every time when server starting?
i get this error
Empty as in no players?
eehh perhaps this would be better, actually? or naw?
Show the code you did in the onEnable and the new event class
?paste
And use a paste so it doesn't spam the channel
i’m sure you can get all the worlds and the you a loop for each block in a certain radius
there’s no easy way
Because you moved it to a new class, you have to change how you're getting the plugin instance for the scheduler.
I'd recommend Dependency Injection for it
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
?
idk why your checking the items pdc when you dont need to change that at all, you are checking for key2 when you set key1, you set pdc if anything happens
I have two keys, one for the actual item its self and one which you advised setting for the confirmation no?
shit
I see, i've checked wrong key
give me a moment ill type what i mean up
Okay no problem
Maybe set a timestamp and then give them 5 seconds to press enter, else it sets a newtimestamp
Can someone explain to me why the message is still posted in the chat even though I use e.setCacelled(true);. https://prnt.sc/AZNQBgTXEZnl
Is there something like event.getClickedSlot()?
//push
#nomove but you can also see in the screenshot
i dont see you using setCancelled(true) int hat
My mistake but it still does not work https://prnt.sc/gwxtf0yz9EGD
what messages get sent to the player?
#nomove <user>
args.length isnt 2 then so thats why that part doesnt work
What should I do then
#nomove <user> and then it is displayed in the chat but I want to have it so that the message is not displayed
yes
This is how it looks in minecraft. I have hidden my name because it is not so cool https://prnt.sc/whsUtOP8kb4Z
Yes
Ah i see. Yeah will create a timestamp for this too. Thanks
#nomove <username>
yes
When I type #nomove <player name> the message is displayed in the chat. But I do not want that
I have hidden my name but I have also written to it
No error comes
No
Just use a command?
It's so funny all of a sudden it works. Thanks for your help
You are someone who helps "best"
Exactly, use a command do not use chat for that stuff.
Why is PlayerInteractEvent called twice when right-clicking on a stone?
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
no clue
Good day! I've been trying to send a chat packet from bungeecord to an attached server. When trying to construct it. I appear to be getting the following error: https://pastes.dev/iI9yFblSrO . The code i'm using can be found here: https://pastes.dev/8tvtyft2p8 . A few versions ago, constructing the Chat packet with just the message seemed to work. I tried the current code as an alternative but everything yields the same result.
mojank
As a bit of context. We've got a punishment plugin on bungeecord but on some specific servers, I want to use the punishment commands from that specific sub server, not from the bungeecord plugin. This solution has been working before chat signing was added by minecraft just fine. Seemed to break after that
what kind of inventory is that??
resourcepack
I got it fixed but how can I stop the raytrace if it goes through a block?
but which inventory? this format doesn't look common to me or am I just stupid
54 slots
does BlockBreakEvent#isDropItems take into account whether the player is in creative or not?
oh yeah now I understand the textures
how it feels to not know how to use patches and then checkstyle+surefire not showing the errors in IDE
can i have that code
sorry its property of winnpixie™️
damn
oh fukc U
forgot about the bukkit class
wish i knew how to just like
merge the patches too
granted ive touched like 3 files tops so i could just redo buildtools
yeah im resetting it and trying again
ill send u the patch files once i stop being stupid @remote swallow
altho not like its nontrivial
thanks
only way itd get more involved is if i made it persist across server restarts
bc this is only a per-session thing im testing
are you gonna pr it
debatable
like someone else said earlier when i asked why they werent already in API-- theyre pretty useless unless ya make them save to server.properties
Can you check over this timestamp i added?
?paste
https://paste.md-5.net/hivuculihi.cs - Adding them to a map with system currenttimemillis, getting the difference between when they were added and the current time in millis and dividing that by 1000, if it's greater than 10 removing the key and removing from map
the only problem you would have with that is someone press q, waiting 10 seconds and pressing it again
it would just loop in that case
That's what I'm after no? I want it so if they press q, 10 seconds go by and they try do it again they have to re confirm (PRess it twice, within 10 seconds) but it's not working, after 10 seconds I can just press q and drop it
yeah ig
it only runs when you drop anything
No, I have a check for specific item pdc?
I have two keys in that event being checked
your time check will only run when you drop anything, it wont run if you just wait
ah yeahh
0016 goes to Spigot/Bukkit-Patches and 0092 goes to Spigot/CraftBukkit-Patches @remote swallow idk
thanks
feel free to change the names of the patches (if its possible) idk
patches were made against a fresh build of 1.19.3 from BuildTools
and ofc add restart persistence :^)
How can I check if a raytrace was interrupted by a block?
Hey, why is this happening?
Stacktrace: https://paste.md-5.net/duritesizi.pl
Code:
CollectionMaps.forEach(attributeModifiers, (attribute, modifier) ->
Objects.requireNonNull(entity.getAttribute(attribute)).addModifier(modifier));
//
public class CollectionMaps {
public static <K, V> void forEach(Map<K, Collection<V>> map, BiConsumer<K, V> action) {
map.forEach((key, value) -> value.forEach(it -> action.accept(key, it)));
}
}
PreparedStatement ps = plugin.data.getSQLConnection().prepareStatement("INSERT IGNORE INTO points(UUID,NAME,POINTS,COOLDOWN) VALUES (?,?,?,?)");
anything wrong with this? console keeps saying:
org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near "IGNORE": syntax error)
try INSERT OR IGNORE
why tf is BlockBreakEvent called when i left-click with a sword in creative???
new error, lads!
[14:43:28 WARN]: org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)
[14:43:28 WARN]: at org.sqlite.core.DB.newSQLException(DB.java:1030)
[14:43:28 WARN]: at org.sqlite.core.DB.newSQLException(DB.java:1042)
[14:43:28 WARN]: at org.sqlite.core.DB.throwex(DB.java:1007)
[14:43:28 WARN]: at org.sqlite.core.DB.executeBatch(DB.java:832)
[14:43:28 WARN]: at org.sqlite.core.CorePreparedStatement.executeBatch(CorePreparedStatement.java:64)
[14:43:28 WARN]: at Points-1.0.jar//me.goosbanny.points.tasks.DataSaver.lambda$run$0(DataSaver.java:40)
...blah blah useless stuff
```https://bin.birdflop.com/efisapahig.java
autocommit is disabled
insert ignore into
He is inserting into points, ignore is an sqlite statement
anyone know what could be causing the db to get locked? the code itself is given right below.
nah haha
the question is by what its locked
Just a shot in the dark, but you should rollback that statement in catch right?
A transaction locks a table I believe in order to prevent errors
if an error occurs you want your changes to be undone
there is only one?
??
why not
How to define a player in the event ServerCommandEvent e.g. Player player = e.getPlayer();
cuz the block doesn't get broken?
Player player = (Player) sender;
Thanks
slight problem with that
still.. why not :D
the jds for that event say This event is called when a command is run by a non-player.
It does not work
you are trying to get the player from an event that wouldnt have a player
check cancelled state
Hey guys iam having one issue when i try to access spigot web This challenge page was accidentally cached by an intermediary and is no longer available please help me
iirc it is true by default
Does it still work somehow
restarting fixed it
huh
i should probably not /reload when working with dbs lmao
close connection on disable
Do you have it opened in some sqlite browser or smth
right.. except
yeah /reload can cause stuff to break
nah
already closing it onDis.
weiiirdd.. but it's /reload sooo
can't complain
How can I check if a raytrace was interrupted by a block?
doesn't a raytraceresult have a getHitBlock or something? if that is not null a block has been hit
it automatically stops when it goes through a block?
I'm using .rayTraceEntities()
Anyone know how to implement auto selling with vault api?
Then you probably need another method
listen to the events that would produce the stuff you are auto selling, remove the items and add an amount of money with eco
Sounds good thanks
How to restart server?
I use Bukkit.getServer().spigot().restart()
But nothing happens
just stop the server
and in the startup script you start it again
on .sh its
while true
do
JAVA SERVER STARTUP HERE
done
I want to do it in plugin
i guess if you run restart the server stops itself and rerun the start script file
do you get any errors
Attempting to restart with ./start.sh
no
Only that
does it just stop the server
Yes
its doing what the method says it would
so it does something lol
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Server.Spigot.html#restart() Restart the server. If the server administrator has not configured restarting, the server will stop.
declaration: package: org.bukkit, interface: Server, class: Spigot
Ok, sorry
the restart stuff isnt setup so it cant restart auto
+1
Should i setup it in spigot.yml?
settings:
debug: false
sample-count: 12
timeout-time: 60
restart-on-crash: true
restart-script: ./start.sh
I think i did it
don't forget to make the script executable or call it through a shell instead
then just use the normal raytrace method
it'll look for entities and blocks
and stop whatever it hits first
Script name is start.sh
are you on linux?
Yes
what's the problem?
?paste your script
#bin/sh
screen -S test-p-1.19 java -Xms2048M -Xmx2048M --add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -jar server.jar --nogui
nooo
do not use a screen session from inside screen
create a new script called restart.sh
without screen?
inside that, just do
#!/usr/bin/env bash
java ... -jar server.jar --nogui
your restart.sh should NOT call screen
also I'd combine both scripts
SCREEN=""
if [[ $1 == "screen" ]]; then
SCREEN="screen -S test-p-1.19"
fi
$SCREEN java -Xms2048M -Xmx2048M --add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs/ -Daikars.new.flags=true -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -jar server.jar --nogui
then you could do ./start.sh screen to run it in screen and your restart thing could just call ./start.sh
otherwise you'd have to adjust the params in both scripts
but tbh I wouldn't use the restart option in the first place
if your java proc gets killed by the OOM killer or something, it wouldn't work I guess
I'd rather just use a systemd service
that's the best option for sure and also the most comfortable one
#!/usr/bin/env bash
java -Xms2048M -Xmx2048M --add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs/ -Daikars.new.flags=true -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -jar server.jar --nogui
Its my restart.sh
Should it work fine?
I guess it should work
Hello, my plugin has been lagging the server for no reason. I recently upgraded the server host to a better service on the same provider and now when connecting to mySQL it's taking 25000ms(20+ seconds) instead of the usual 20-30ms.
Error:
https://paste.md-5.net/jumumecafu.md
What can be causing this? It's on the mySQL connection but makes no sense.... it was working fine before upgrading host...
I know I'm using paper for server version 💀 but plugin is in spigot.
restart
[20:33:54 INFO]: [STDOUT] [org.spigotmc.RestartCommand] Attempting to restart with ./restart.sh
[20:33:54 INFO]: Stopping server
[20:33:54 INFO]: Saving players
[20:33:54 INFO]: Saving worlds
[20:33:54 INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld
[20:33:56 INFO]: Saving chunks for level 'ServerLevel[world_nether]'/minecraft:the_nether
[20:33:56 INFO]: Saving chunks for level 'ServerLevel[world_the_end]'/minecraft:the_end
[20:33:56 INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
[20:33:56 INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[20:33:56 INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[20:33:56 INFO]: ThreadedAnvilChunkStorage: All dimensions are saved
[20:33:56 INFO]: Flushing Chunk IO
[20:33:56 INFO]: Closing Thread Pool
2023-01-02 20:34:00,055 Log4j2-AsyncAppenderEventDispatcher-1-Async WARN Advanced terminal features are not available in this environment
[20:33:59 INFO]: Closing Server
Its my logs
are the database credentials correct?
did you make restart.sh executable?
Yes
yes they are, as far as I know
if they were wrong a error should have appeared
connections have a try/catch
nah it can happen that it's a firewall issue
e.g. if you upgradeded the server, the mysql ip might have changed
hm maybe thats why, this "upgraded" servers are new on the host
i updated the server link
then it waits like 60 seconds before it says "connection refused"
i noticed that and thought was that at first so i updated
and paper dies before that
have you checked whether the mysql ip is correct?
after upgrading
im using url connection
yeah but you have to give at least SOME hostname
127.0.0.1, 1.2.3.4, db.myhost.com, something
the mysql "data" itself stayed but the "server" changed so I updated it but still super laggy
🤔
after stop my screen just closing
idk what that is so i assume no
check your server panel if you see sth like "ssh"
How would one add the whole SUM amount instead of it spamming each individual sale
no
i assume i would have that if it was a vps? but it's just a single server
can other plugins access your mysql database fine?
i dont think im using other mysql plugins
why instantiating bukkitrunnables for no reason
what is that even supposed to do?
its happening when someone joins server to get their data
correct but im trying to figure out why is it not connecting
are you loading data in async pre login event?
main thread or not, it was working fine before.
the threads wouldnt be a issue here for the connection
I don't think that "making it async" is a proper fix for "I cannot connect to my DB because it times out"
lol
it was working 1hour ago on previous host
just use a file based db or smth that ships with the plugin
with the same exact code
that doesnt fix the issue
yes and that's not the problem
did you send the code
the problem is not the thread dying ut the "cannot connect" in the first place
then atleast it doesnt take 20secs
then it would say "connection refused"
timed out is 100% network issue
yeah I can connect to the host they gave
it was working for past month on previous host
this has to be a host issue, not the plugin itself
try to ping your domain from that machine, maybe you are behind nat and cant use public address inside of local network
we need a plugin developer. anyone here for medium budget plugin dev ?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
why using an online host too and not just shipping a db file with the plugin?
how? 😂
its a mysql that can be accessed from other sources
you have vps or some shared hosting ?
for what reason
not really
for my reasons and tests
"just change the way you store data" doesnt fix the issue that wasn't happening for a month and now happens when swapping hosts
bruh, have to ask support then, but take a not that it might be nat issue
you can also try to use local ip
instead of domain
i feel like this is a diff issue and some people here are trying to ignore it instead of finding why
it does
it fixes the issue by not fixing it
try to use local ip insted of this
he cant connect to db..
he already gave
it lags and sends this
every "has not repsonded for 10 seconds".... 20 seconds.. .30... 40...
well the error there is when connecting
this is when it tries to connect to it.
then i dont know what you mean by this
😅 sry
ah
i posted above
1sec
well i sent this cause it has the password there
sure... it's just that tho
here
does the web panel actually tell you to use "minecraft3667.omgserv.com" as mysql host, or do they also give you some IP address?
if so, is that IP 62.210.233.174 ?
then go try other plugins
btw, I added luckperms on the server
Luckperms
yap, working totally fine for me too
config.yml, look for the "storage" section, set "storage-method" to mysql and fill out the details
restart server and see whether luckperms throws an error
and/or check whether it could successfully create the tables
save your data first ofc
if yes, sths wrong with your code.
if not, mock your hoster.
Guys can anyone pls guide me through this
Idk what I'm doing wrong but I'm trying to replace a message sent by the player
But it's still looking as default
this?
probably dont need replaceAll
rulesNames? That's a weird variable name for a Rule[]
yes
But, I'm trying to replace like "Hello guys" to "Cya guys"
ok, i changed to mysql, restarting server
This is the rule class
did you also fill out the details? host, username, pw?
whats that doin
i guess its not just my plugin
that is wrong password, host, user
ah
let me fix
I'm storing all data in an arraylist with that information, then I want to check if a player sent a message which equals the "input"
If so, it will replace that message with the "output"
what even is a rule
then check if message.equals(input)
you don't need replaceAll if you just want to replace the whole message
sorry sorry
btw you should NEVER use replaceAll unless you want to use regex
just use replace(...) to replace things in strings
why does that method has such a stupid name tho
?paste
replaceAll you mean?
ye
@tender shard @hazy parrot here's the new error for connecting to it:
https://paste.md-5.net/idirijopob.sql
🤔
literally same thing
both replaceFirst and replaceAll take a regex. a proper name would maybe replaceRegexFirst or sth but idk
yeah it's a weird name
So, if event.getMessage().equalsIgnoreCase(rule.getInput())
no, replace uses chars or strings, replaceAll and replaceFirst use regexes
Then event.getMessage().replace(Old String, new String)?
ah didnt know about replaceFirst
tell your hoster to fix their routing between mc host and db host
anything in specific i should tell to fix or just like that?
love it how i cant longer open ij on linux
What did you do?
just tell them you can connect to the database from your home pc but not from the actual mc server since it simply times out during connect
?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.
idk desktop environment broke and the shortcut in the app menu broke too, can only open it from the app store now lol
last time im using kde neon, so many bugs
okay thank you a lot for your time alex once again 🙏 I'll do it, hopefully they fix it quick.
or do you actually wanna check whether the rule is called "equal"?
np!
Ofc!
There will be more types
why arent you using a map
I really have no clue what that whole method is supposed to do
I mean
if you have a rule called "equal" and you loop over all rules, then this will always at some point be true
Ok I'll explain it to you
I used plain debian with KDE Plasma worked fine no bugs
so why do you loop in the first place
might wanna use plain debian then too
debian is the best distro
I have an arraylist, with n number of rules
as i have the most experience with that
Some are gonna have "type: equal" others will not
ooh now I get it
So, if the rule the loop is checking has "type: equal" It's gonna get its input and its output
i dont
and then replace the message only if a player has sent the "input"
he has rules like this:
rule1:
text: "jesus"
type: equal
rule2:
text: "asd"
type: contains
the string "jesus" would match rule1 but "jesus123" woulod not match
equal jesus
"asd123" woulod match rule2 and "asd" would match too
Exactly
and whats with the rules
and an output too
for(Rule rule : allRules) {
if(rule.getType().equals("equal")) {
if(event.getMessage().equals(rule.getText()) {
event.setMessage(rule.getReplacement());
}
} else {
if(event.getMessage().contains(rule.getText()) {
event.setMessage(event.getMessage().replace(rule.getText(), rule.getReplacement());
}
}
}
I'd just do it sth like this
wdym
what do those rules input and output thing do
it's a chat filter
🤔
have you ever seen a chat filter?
ik what that stuff is supposed to do :
So is my code right? I mean the last pic I sent?
updated
no
there is no need to use replace in this case
if the message equals, then why bother replacing it
instead of just seting it
btw chatfilters should support regex
looks like it
tysm
hey, i've made a library plugin (EssenceAPI) that i want to use in my project (EvolvedPrison), but i've noticed some weird behaviour and I did some debugging and I have found out that for some reason the main class of my library (EssenceAPI) is not the same as the one i have imported with maven. I have made a local repo by using the "install" plugin when compiling EssenceAPI.
This is the code in the onLoad method of my plugin (EvolvedPrison):
Class<? extends JavaPlugin> class1 = ((JavaPlugin) Bukkit.getPluginManager().getPlugin("EssenceAPI")).getClass();
Class<? extends JavaPlugin> class2 = EssenceAPI.class;
getLogger().log(Level.WARNING, class1.getName());
getLogger().log(Level.WARNING, String.valueOf(class1.getClassLoader()));
getLogger().log(Level.WARNING, class2.getName());
getLogger().log(Level.WARNING, String.valueOf(class2.getClassLoader()));
getLogger().log(Level.WARNING, String.valueOf(class1 == class2));
and this is the console output:
[17:14:14 INFO]: [EvolvedPrison] Enabling EvolvedPrison v1.0
[17:14:14 WARN]: [EvolvedPrison] me.kill05.essenceapi.EssenceAPI
[17:14:14 WARN]: [EvolvedPrison] PluginClassLoader{plugin=EssenceAPI v1.0, pluginEnabled=true, url=plugins\EssenceAPI-1.0.jar}
[17:14:14 WARN]: [EvolvedPrison] me.kill05.essenceapi.EssenceAPI
[17:14:14 WARN]: [EvolvedPrison] PluginClassLoader{plugin=EvolvedPrison v1.0, pluginEnabled=true, url=plugins\evolvedprison-1.0.jar}
[17:14:14 WARN]: [EvolvedPrison] false
also it's worth mentioning that EvolvedPrison has EssenceAPI as a dependency in plugin.yml:
name: '${project.name}'
version: '${project.version}'
main: me.kill05.evolvedprison.EvolvedPrison
load: STARTUP
api-version: 1.19
authors: [ kill05 ]
description: '${project.description}'
depend:
- 'EssenceAPI'
softdepend:
- 'DeluxeChat'
- 'PlaceholderAPI'
sorry for the long message but i've tried to provide as many details as I could
I just tested it and for some reason, the chat is not getting replaced
:c
or changed
is essence api a lib or plugin that runs on the server
it's a plugin that runs on my server that is also imported as a dependency in my pom.xml
mvn clean install the lib
mvn clean install the plugin
reinstall both .jars on the server
so the highlighted one?
Or something like this:
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import java.util.ArrayList;
import java.util.List;
public class ChatListener implements Listener {
private List<Rule> rule = new ArrayList<>();
@EventHandler
public void asyncChatEvent(AsyncPlayerChatEvent event){
rule.forEach(
rule -> {
if (rule.getType().getMethod().test(event.getMessage(), rule.getString())){
event.setMessage("false");
}
}
);
}
}
import java.util.function.BiPredicate;
public enum FilterType {
EQUAL(String::equals),
Contains(String::contains);
private BiPredicate<String, String> method;
FilterType(BiPredicate<String, String> methodReference) {
this.method = methodReference;
}
public BiPredicate<String, String> getMethod() {
return method;
}
}
public class Rule {
private FilterType type;
private String string;
public FilterType getType() {
return type;
}
public String getString() {
return string;
}
}
press shift quickly twice, then enter mvn clean install
i thought your meant to do control twice for build command stuff
oh
Looks like it's not reaching this part
maybe it's control
shift is the search isn't it
then the message doesn't equal the rule's input
yea it's ctrl
But I'm sending the exact same message
kk restarting the server
message and rule input
print out both things to console - the rule input and the actual text
[17:24:58 INFO]: [EvolvedPrison] Enabling EvolvedPrison v1.0
[17:24:58 WARN]: [EvolvedPrison] me.kill05.essenceapi.EssenceAPI
[17:24:58 WARN]: [EvolvedPrison] PluginClassLoader{plugin=EssenceAPI v1.0, pluginEnabled=true, url=plugins\EssenceAPI-1.0.jar}
[17:24:58 WARN]: [EvolvedPrison] me.kill05.essenceapi.EssenceAPI
[17:24:58 WARN]: [EvolvedPrison] PluginClassLoader{plugin=EvolvedPrison v1.0, pluginEnabled=true, url=plugins\evolvedprison-1.0.jar}
[17:24:58 WARN]: [EvolvedPrison] false
this is the new log so nothing changed :c
do you shade it>
i've ran the command on both projects
?
yeah you are shading it
that's the problem
wait isn't provided the default scope?
no
compile is
Here it is
the default
oh
its compile
i wish i knew before debugging for hours
that's why I always declare everything even when using the default values 😄
that's why i use gradle 😀
because it has a different default scope?
ofc it has, gradle doesnt even have an official shade plugin
Show th efull code, thnak you.
Don't bother with gradle and spigot
If you wanna use gradle switch to using paper
not really for spigot but for other projects
gradle has like a bunch of files 🤔
when you declare dependency you explicitly specify it
print out all fields of the rules you are looping over
like
implementation(...) or compileOnly(...)
so you always know it
almost 2 years of java and still copy-pasting maven and gradle imports lol
nah
i use the mc dev plugin in intellij and have default build.gradle setup lol
no need to type that by hand.
maven has 2.8% and gradle 0.2% - if those numbers are true, idk
yeah but like gradle is 100 times more readable and compact
I don't think so at all
instead of 100 lines of shitty xml you have 10 lines of kotlin
build.gradle files are so confusing
fuck kotlin
Fuck kotlin
I love that maven uses XML
kotlin > groovy
it's so easy to read compared to weird groovy syntax
i don't mean for plugin code, just for the build file
also what does the shade plugin do if you can just specify compile as the scope?
groovy > kotlin
that's why i use kotlin dsl
it shades?
I also don't like gradle because the shadow plugin is shit
i mean doesn't compile already do that
how so?
and stuff like "why do I have to specify my local or central maven repo"
by that i mean include the packages of the dependency in the compiled jar
ill give you that in some cases
it cannot relocate, minimize and filter at the same time
and it's not an official plugin
Cause it makes sense
it's made from some random githu dude
it CAN relocate
AT THE SAME TIME
its on their plugin system so is offical
please read my full message
It can, but it is probably in another way than what you are trying to do. We are just too lazy to help you
go to tph and ask instead and they'll waste their time to do it.
I do, we had this chat before.
it can NOT. do filtering, relocating, AND minimizing AT THE SAME TIME
it can do every of those things
but not all 3 together
Obviously you just need to do it a more complicated way.
yeah and in maven it's so easy
I don't get how people make private mine plugins and arena plugins like practice
I don't hate gradle, I just think maven is way more powerful in terms of builtin plugins, and "uuugh xml has soo many lines" is a quite stupid argument
I just took a look and it seems like it should be working
I think XML is way more tidy
anyway, if any gradle expert is able to fix this, that would be nice
?paste
i would say @echo basalt may know but im not sure
hello again, for some reason I get this error when I look to steeply down but only then. If I don't look steeply down everything's working fine: https://paste.md-5.net/uxejefozix.pl
I use gradle but I'm no expert
If anyone can tell me why this isn't working, that would be nice too... At the moment the confirmation is working perfectly but it should be having a ten second timer that resets, so q to drop item, asks to press it again to actually drop the item. If 10 seconds goes by and you don't click q again it resets back to having to confirm. https://paste.md-5.net/kuwosileja.cs - I've been told to use a schedular which is my next plan but i've moved on from this for now so if anyone can enlighten me, thanks 🙂
i guess i finally found out how to do O(1) hashmap
but i want to know how java's rehashing works
I've asked sooo many people already, nobody knows
for hashmap
mfnalex, could you take a look at the pic? :c
what's ForcepowersListener.java line 98?
brb gotta cook
i don't see what's the problem with doing all 3 things together
i just tested, and it works fine
has anyone else had discord saying "be careful on this download link" on paste.md-5.net links
shouldn't you be posting it to shadowJar community, not on your own project xD
EVERYTIME
yes
whats discord done now to fuck that up
line 98 is moved.teleport(moveStart); from this method: https://paste.md-5.net/odirugatar.cs
It's always been like that afaik
You might have white listed it
theres no button for it
What?
to whitelist
on the paste link on the message im responding to i get
your movedstart variable is cringe then
i then dont get it on this one
Wtf? That's so weird
There's no issue here. I wrote the following build file.
plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
java
}
repositories {
maven("https://hub.jeff-media.com/nexus/repository/jeff-media-public/")
}
dependencies {
implementation("com.jeff_media:JeffLib:12.0.0")
}
tasks.shadowJar {
relocate("com.jeff_media.jefflib", "me.username.jefflib") {
include("com/jeff_media/jefflib/internal/nms/**")
}
minimize()
}
When any of the nms classes are referenced in the code, the jar contains all required classes inside me/username/jefflib/internal/nms. When there are no references to any nms classes, jar is expectedly empty because of minimizing. All jefflib classes outside of internal/nms are NOT relocated, but rather shaed in com/jeff_media/jefflib because of the filtering. There is absolutely NO problem with the gradle or shadow plugin.
yeah
thats what i was thinking
it started earlier
this might be the issue
what
are u sure it's line 98 in your current code version
can you print out location after .add()
just clone then add?
and before tp
don't think this is the issue tho, but .clone() is always better when working with locations
gimme a second
cuz some methods return clone, and some the actual location
the location of the moving entity or of the targeted entity?
of the moving entity right?
yes
print it
I got this as location: Location{world=CraftWorld{name=world},x=NaN,y=NaN,z=NaN,pitch=79.64987,yaw=84.93686}
dividing by 0 just makes the result 0
that gives me a syntax error in line 3 (java)
that's multiplication
It's not groovy it's kotlin
well, now print it before .add()
Gross kotlin
Use build.gradle.kts
no
cuz as i said it might be the issue
Lol I'm joking idk what this brit is doing
Why you hate it so much?
its bad
Why??
who wants to use val something instead of specifiying type
Guys can anyone pls help, Idk why this ain't working
You van specify type after 😈it just looks like shit
?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.
Well it's not worse than groovy
yeah, thats what i hate more
k
groovy > kotlin
I don't get any errors, it should replace a message sent in the chat but it's not doing it
kotlin hater spotted 👆
usign gradle build creates only an empty jar
yes
use gradlew build
This is the rule class
You should use shadowJar instead of build
same thing
also do you have a build {} area
still empty .jar
@young knoll how do you write multi module gradle stuff
Is there any usage of nms stuff in code of the project?
Does anyone know if protocollib has a discord or unofficial community where I can ask questions?
Ive never used it before, and it would be nice if there were a place to ask them other than just inside of github tickets
in jefflib ytes
You minimize it
no but even if there was, it's only accessed through reflection
doesnt look like it
That doesn't count
he can minimise in maven but tell it to include files, on gradle it wont let him is his problem
now it actually gave me a location: Location{world=CraftWorld{name=world},x=345.29961288477193,y=124.0,z=68.1742196950407,pitch=88.79999,yaw=-52.613102}
How can i fix this?
Then exclude from minimize
https://imperceptiblethoughts.com/shadow/configuration/minimizing/
Empty jar is expected cuz of minimize
he can exclude fine he just cant include, exclude and minimize
Fix your reflection code?
aaaaaaaaa
Use mojmap man - that is the next big thing
between .add and .teleport it was Location{world=CraftWorld{name=world},x=NaN,y=NaN,z=NaN,pitch=79.64987,yaw=84.93686}
and before .add it was Location{world=CraftWorld{name=world},x=345.29961288477193,y=124.0,z=68.1742196950407,pitch=88.79999,yaw=-52.613102}
Minimize removes all classes that aren't used. If you want to keep them, exclude from minimize block
Did yo add NaN/NaN/NaN to your location or what?
this is my code:
https://paste.md-5.net/odirugatar.cs
Can you print the value of currDX, currDY, currDZ?
YOUR values are too high
you calculated them wrong way
and well, you need to check them out
The issue is that NaN is very hard to get in java world
POSITIVE_INFINITY and NEGATIVE_INFINITY exist for most cases where you'd expect NaN
thus NaN only really happens due to a Math#sqrt op
so what should I change on the code then?
So yeah, path.length() may be NaN and thus triggering that chain of events
?stash let's see why that could be
NaN will be returned if the inner result of the sqrt() function overflows, which will be caused if the length is too long.
Basically the X and/or Y and/or Z field (or all of them combined) of your path Vector is too large
But why does this only happen when I look too steeply down?
what does sqrt even do
...
Are you german by any chance? I don't know the english lingo there
Square root
british
smh