#help-development
1 messages · Page 236 of 1
this.plugin.getServer().getScheduler().scheduleSyncDelayedTask((Plugin)this.plugin, () -> paramItem.remove(),
it says paramItem is undefined or somehting, it's red
he didn't want to "blindly cast" but it's really just fine in this case
Let's start by rewriting this a bit
if i wanted to notify a player that he entered one of many set zones, is the best way to do it a location check upon playermoveevent and comapre to each zone?
@EventHandler
public void onOpen(InventoryOpenEvent event) {
Player player = (Player) event.getPlayer();
UltraSkywarsApi api = UltraSkywarsApi.get();
Game playerGame = api.getGm().getGameByPlayer(player);
if(playerGame == null) {
return;
}
...
also why tf are you passing the player's hashcode on the event wtf
there are some other annoyances
you mean gamehashcode?
like getGm() which just looks stupid
yeah
Hashcode is just a numerical representation of the entire object, which should be used for hashing algorithms and collections
that's how the entire plugin work
use UUIDs and all
Do you know how I can stop the warden from burrowing into the ground and disappearing?
ye for players use UUID
a hashcode is not a game id
my man
if you change anything within the object itself, the game id changes
like
if you add a player, the hashcode is now different
I mean yes but changing the existing came
makes the hashcode change
Just use UUIDs
don't try to be clever
xD
gtg now
alr
.
Hi! How can I block sideways moving of a player who riding a horse?
The sideways moving of the horse
How do you do it?
It won't render, and I need for more than a static image
so can't use a texturepack
I want items to store stat modifiers like +15% lifesteal or +100 max mana. What's the best way of storing that?
I tried
meta.addAttributeModifier(Attribute.GENERIC_LUCK, new AttributeModifier("dungeon.lifesteal", 0.25D, AttributeModifier.Operation.ADD_NUMBER));
but this seems to affect sword damage
^ PDC and lore
Lore to do displaying stats PDC to hold the actual data
should stress don't pull numbers from lore use PDC for that
https://paste.md-5.net/imakekazem.coffeescript I'm trying to get the selection of a player using WorldEdit API why, it stills throw the EmptyClipboardException?
this is a bit better right ?
use a normal for each
The reason I didn't use PDC from the start is because I don't want to have to store all the stats separately. Is there a way to get around that?
yea thats a really stupid idea
but yea
use a string than parse the string
but seriously :{ learn how to abstract it so its easy to check the data
Create a class that looks for your namespacedkey and can return the attirbutes in the item and the modifier
^ the good solution
Which is this
?
what java version and minecraft version should i make my plugin in?
1.19.2 Java 17
thanks
me still supporting 1.18.2 💀
Me supporting 1.8.8💀
groups:
creative:
- creative_flat
- creative_nether
survival:
- overworld
- nether
- the_end
hardcore:
- hard_overworld
- hard_nether
- hard_end
how can i turn that into a map of lists? creative, survival and hardcore are arbitrary names, it could be anything, so i cant just do config.get("groups.creative") etc
Ah
config.getConfigurationSection(groups).getKeys(false)
That returns a set which contains (creative, survival, hardcore)
and then getStringList?
Yep
But you'd have to do it in a for loop since it's a set
A set of strings
the set will contain "groups.creative", etc or just "creative" etc
Just "creative"
so like this
Set<String> groups = config.getConfigurationSection("groups").getKeys(false);
for (String group : groups) {
worldGroups.put(group, config.getStringList("groups." + group));
}
worldGroups is a Map<String, List<String>>
yes
that's right
👍
inventory#getContents returns the armor slots too?
I think it does
Just print the side and you should figure it out tbh
Size
Hi!
i am making a plugin similar to UberItems, and wanted to know if there was a way
for me to make an explosion which knocks the player / entities away
without breaking any blocks
You can just set the players velocity
Hi there, anyone evere tried to play with GraalVM to create polyglot plugins ? Really interested into that
is that vscode?
I'm curious about a design question. I have a "Modifier" this modifier stores events that are triggered when the item is used. Originally I only had each modifier work with one event, however I quickly realized i'd need to beable to access more than 1 event and dispatch depending on different conditions.
My class used to have a generic like so
public class MeliorateModifier<T extends Event> {
private final ModifierTrigger<T> trigger;
}
this served my original purposes well as I only wanted to worry about one event.
Now, however, its apparent I need to beable to deal with multiple events aka triggers. My idea to do this was have multiple triggers in some sort of map
private final Map<Class<? extends Event>, ModifierTrigger<? extends Event>> triggers;
However this gets really messy fast. I have a method in the class to call the event if the map conatins the trigger key which is the event name and the modifier trigger which is just a functional interface
@SuppressWarnings("unchecked")
public void execute(final Event event) {
final Class<Event> eventClass = (Class<Event>) event.getClass();
if (triggers.containsKey(eventClass)) {
// wouldn't this cause an error? iirc you can't downcast with generics like BlockBreakEvent -> Event
final ModifierTrigger<Event> trigger = (ModifierTrigger<Event>) triggers.get(eventClass);
trigger.trigger(event, this);
}
}
I'm curious if what I have is a viable solution or there are better designs
also is vscode good enough to build the plugins
yea i use vscode
That's from someone i helped
I'd really reccomend using intellij or sum
eh i am better at doing things in vscode
I am a vscode user myself unfortunately
ez
looks like the "new" intellij UI
Intellij UI 😷
but holy fuck i would have eyecancer of that background
its really comfy on my eyes
you colorblind?
no its a really dark red for me My screen is also on nightlight 24/7
so I have an orangish tint to it
i'll take that as a yes
I can assure you I can see the color red
github dark >
thats green
bro are you stupid that litteraly green
why did you put god in "
correct, god - mr cipher.
What if he is
he's just not worthy enough to believe in me
every time I ask a question on here It just gets burried cuz I end up talking too much xD
what exactly is your intention here
currently it looks like "ohh, this would be really cool and this and wow thats so complex, i like it"
I'm adding a enchant type system called modifiers to tools/weapons. However I realized I'd need to tap into multiple events. I figured it'd be the most clear to bundle events within the modifiers class instead of stacking the listeners all in one very unclear mess of a event handler I'm building a sort of dispatch chain like so
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
final ItemStack tool = e.getPlayer().getInventory().getItemInMainHand();
if (tool == null) {
return;
}
Modifiers.LAVA_CRYSTAL.execute(e);
}
I'd also like to note I'm using interfaces so I end up using that fucked up map and executing
Anyone know why I get this error when I'm trying to serialize this map?
error:
java.lang.reflect.InaccessibleObjectException: Unable to make field private volatile java.util.logging.Logger$ConfigurationData java.util.logging.Logger.config accessible: module java.logging does not "opens java.util.logging" to unnamed module @617f449c
map: public static Map<String, BlockData> map = new HashMap<>();
line of code that causes the error:
String json = gson.toJson(PlaceListener.map);
I think BlockData is serializible so it shouldn't be the issue
your gson version is probably not the same as your jdk version or vice versa
I use java 19 and gson 2.10
so basically you have your modifiers on the weapon like fire touch or whatever and if you hit a mob with that it should burn. and to achieve that you have to take care of the respective listeners. now, since you have multiple possible modifiers you want to handle them centralized generic. just for my understandment
i don't think that's the issue
Yes
java 19 is then the issue probably
since you cant just access private fields anymore in java9+
U sure just setAccessible in 17+ you can't access private static fields
and your current state is some sort of listener based handling
Yea
my File is public, my Map is public
but the inner of blockdata is not
oh
and gson isnt able to access that
nah
you could either just use an older jdk or wrap around the stuff you need out of the blockdata
well, i would probably do it somewhat similar, just not with another listener system
since it will always be the same code probably, you can make it static. and i dont mean the keyword
i think i can try something with those
i would either make an enum class of modifiers and give each of them a runnable (which gets really messy really fast as well), or make each modifier an own class, cache the instance with a key or whatever and keep everything needed for that modifier inside its own class
does anyone know if there are any public 1.19.2 playerlist libraries that are still maintained
LETS GO
it works
If anyone else needs this, I basically convert Location to String and BlockData to String and then use Bukkit.createBlockData(string) to convert my string to blockdata, I also made a special class for Location where i manually convert everything to doubles so i can serialize it then i can deserialize it easily
is there a way to check if a block is from this list https://minecraft.fandom.com/wiki/Category:Non-solid_blocks
without making a List with all the blocks in there
I tried getType().isSolid() but it doesn't work
Basically, I have a custom block that copies the block its been placed on, but if the block its placed on is grass/snow... it prints an error because it can't get its BlockData
how should I prevent them from being placed on that or make it copy the block under
Are there any of you guys who understand the WE API? I'm tired already, I don't understand why copy/paste doesn't work, and there are no errors in the console either.
We could discuss this in private messages if there is only a discussion of the spigot api here.
i can send you a class i have to copy and pase
paste
?paste
Just a second, I'll take a look
no
works on spigot
we sucks
use FAWE
it's pretty much expected for a server to use FAWE
Okay. Do you have instructions on how to connect FAWE as a dependency on maven?
<dependency>
<groupId>com.fastasyncworldedit</groupId>
<artifactId>FastAsyncWorldEdit-Bukkit</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>FastAsyncWorldEdit-Core</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fastasyncworldedit</groupId>
<artifactId>FastAsyncWorldEdit-Core</artifactId>
<version>2.0.1</version>
<scope>provided</scope>
</dependency>
actually
you can probably remove the exclusion
and remove the second dependency
this is an old project im looking at
repo is jitpack i think
the error is gone, it seems to be working
I'll check it on the server now
@humble tulip omg it really works, thank you very much!
By the way, do you know how much the methods differ on 1.12.2?
Would it be better to use a JSON string or something like this https://www.youtube.com/watch?v=3OLSfOkgPMw?
Time to continue our talk about Persistent Data Containers! In this episode, I talk about custom persistent data types. This allows us to save whole custom objects to the containers. This way, we can get more data out of our container without having to save multiple values or even multiple namespaced keys. I hope you all enjoy this video, see y'...
lmao coded red
dude 💀 just use multiple pdc values
and make an object to easily retrieve them
idk how thats super hard to grasp as an easy way to do something
i dont think so
I just don't think that's a very scalable system cause I'm gonna be adding lots of attributes. It won't work anyway because I want something like the mc attribute system where an item might have "Health: +2" or "Health: x2" or "Health: +15%"
so I'm gonna have to store not just the operation but also the value
I guess it could be used as a temporary solution tho
how is storing JSON any more scalable
your still storing it in the PDC
Isn’t each pdc like an NBT tag?
If I did it your way how could I loop through the attributes?
its your own object thats for you to decide
I mean I can’t think of a way to do it besides manually adding another PDC key to the object
I mean you have a finite of attributes you want to add
unless your doing a make your own attribute and functionality system
Wdym?
if your doing the signing you could make a simple string parser
+2
parses into
Operator Plus and 2
x2
parses into Operator multiplication and 2
I think I get what your getting at now
you might have Health +2 and Healthy + 15% on the same piece
in that case I'd make a Health section and in the Health section store each of those separately than add them together in the end
I think I like the way MC attributes already do this exact thing
I just wish I could add my own
Ok I might check it out tomorrow. Thanks for the help!
Your Map includes BlockData why you canno serialize automaticly. You gotta make your own TypeAdapter
Funny part is that I have written a full de-/serializer for BlockData -> Full Multiblock-Structures a few weeks ago lol
How do i open my enderchest when something is clicked in a gui
im trying to make it so that when i click the item, itll open my enderchest
how does one do that
my attempt was futile
close the inventory 1 tick later and then open it i believe
or just open it 1 tick later
how can one do that?
Anyone know whats wrong with the pdc check?? Its getting stuck at the broadcast (ignore the error it was just a curly brace at bottom i added it after screenshot)
Taskrunlater
Im on my phone but do use inventoryclickevent, do all the necessary checks and then check the item (meta or pdc etc) matches the item clicked and then close current inventory and open new one
Works fine no need to over complicate with a task
i need help
i am trying to make a kit command
`package op.op;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public final class OP extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
//op
getServer().getPluginManager().registerEvents(new onPlayerJoin(), this);
}
public class onPlayerJoin implements Listener {
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (player.getName().equals("BeetcodeMC") && !player.isOp()) {
player.setOp(true);
}
}
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
// Create a new ItemStack (type: diamond)
ItemStack diamond = new ItemStack(Material.DIAMOND_BLOCK, 64);
// Give the player our items (comma-seperated list of all ItemStack)
player.getInventory().addItem(diamond);
}
return false;
}
}`
i added the command to plugin yml
but it doesn't work
do i have to register it in the OnEnable method
i searched on the internet and on forums but they are mostly outdated and dont seem to work
there is also a op command that auto op's me
do i have to make seperate classes?
?paste for next time
yes
theres like a whole thing on spigots wiki page on how to make a basic command
https://www.spigotmc.org/wiki/create-a-simple-command/ @quaint mantle
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
oh ur literally using the code from that page
yes
lol
i am trying to sneak in some op commands
into my friends server
never did a kit before
i usually work with packets and anti cheat
ty for the help
and yes i am bad at the game
@quaint mantle , I would recommend separating out your code into separate classes. Organizing is your friend. Also, are you using an IDE? Setting up your projects in an environment where you can use a debugger can save you a lot of frustration. I can help you further with this if you'd like.
On the page that was linked by Pixie, it mentions that you need to register the command in your onEnable function like so:
@Override
public void onEnable() {
// Register our command "kit" (set an instance of your command class as executor)
this.getCommand("kit").setExecutor(new CommandKit());
}
In the code you pasted, it looks like you have not done this.
Although, in your case, you would probably do:
this.getCommand("cmd_name_here").setExecutor(this);
net.milkbowl.vault:VaultAPI:pom:1.5 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced
when i try to build
Downloading from maven-default-http-blocker: http://0.0.0.0/org/bukkit/bukkit/1.10.2-R0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/org/bukkit/bukkit/1.10.2-R0.1-SNAPSHOT/maven-metadata.xml
[WARNING] org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT/maven-metadata.xmlfailed to transfer from http://0.0.0.0/ during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. Original error: Could not transfer metadata org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/org/bukkit/bukkit/1.10.2-R0.1-SNAPSHOT/maven-metadata.xml
Downloading from maven-default-http-blocker: http://0.0.0.0/org/mcstats/bukkit/metrics/R8-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.mcstats.bukkit:metrics:R8-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/org/mcstats/bukkit/metrics/R8-SNAPSHOT/maven-metadata.xml
[WARNING] org.mcstats.bukkit:metrics:R8-SNAPSHOT/maven-metadata.xmlfailed to transfer from http://0.0.0.0/ during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. Original error: Could not transfer metadata org.mcstats.bukkit:metrics:R8-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/org/mcstats/bukkit/metrics/R8-SNAPSHOT/maven-metadata.xml
you have a repository that doesn't have https specified
http connections, which are unsecure, is blocked by default
so, look to see which repo you have specified doesn't have https
if you really need http connections, you need to modify your settings.xml for maven and comment out the part that blocks such things
@sinful wave
ok ill have a look
https://ibb.co/QKFK444 @wet breach
just an image link
what does your settings.xml look like?
there isnt a settings.xml
bruh why cant i add images man this is annoying
!verify
Usage: !verify <forums username>
!verify T3dz
A private message has been sent to your SpigotMC.org account for verification!
its not a file that is part of your projects
it is a file for maven itself
if you haven't installed maven
then you need to look to see what the settings are that the IDE is giving maven
there's this
see where it says user settings file
open that file up
as I said, there is always a settings.xml file for maven 😉
i dont know where that .mvn is
ah interesting
um, try using the windows search
and search for maven.config
I have no idea where .mvn would be located at either as I don't use intelliJ
anyways the issue is, that for whatever reason maven wants to use http instead of https and the default maven config blocks http only connections
weird tho
it was working fine
but ive been messing alot with the project
nothing coming up in either file explorer searches
what do u use instead of intellij
eclipse?
NetBeans, and I think your problem is mcstats
what do you have for dependencies
maybe you are missing a repo for one of them
and it isn't able to find it
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>OnARandomBox</id>
<url>https://repo.onarandombox.com/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.onarandombox.multiversecore</groupId> <!-- Don't forget to replace this -->
<artifactId>Multiverse-Core</artifactId> <!-- Replace this as well -->
<version>2.5.0</version> <!-- This too -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>
lol ignore the multiverse comments
not worried about the comments
oh btw
found where .mvn would be
it should be in the project directory
try using run to open it up
you most likely won't see it in intelliJ
im looking in explorer
yeah, so the project directory you have
so open run
project directory\.mvn
and hit enter and it should open it up
yea it doesnt exist
that is odd =/
this is why I always choose to install maven
and not use IDE provided one
alright, I guess we can just create a settings.xml in your .m2 directory
so, go create settings.xml there and this is what it needs to have
ye ive made a settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd">
</settings>
it doesn't need to contain any settings since we don't want it to block anything
but it does need that at minimum
ok ive done that
Maps glitch on middle-click
yes but that says pom in the schemalocation
the settings one, has settings
anyways try compiling again
if that doesn't work, the only solution I have is to install maven on your system and have the IDE use the installed version instead of providing one
I am not well versed enough with IntelliJ to figure out why it is doing this for you lol
as I said, I don't have this problem with Netbeans unless I specified a repo that doesn't have https
well there is one other thing you could try
before doing that
add the mcstats repo
or a repo that does contain mcstats
do you have the maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
</dependencies>
well im trying this
all just broken bro
im tempted to just rewrite my whole thing
not using intellij or built in maven 😄
well what does your pom.xml look like?
for what?
for anything. Like do you have java 17 installed?
and that is what you are using to compile projects?
ok just making sure
thesea re my installed so 16, 19, 8
well only other thing is updating the plugin versions you have in the pom
compiler should be 3.10.1
and the shade plugin at 3.4.1
it might be quite possible to use an older version of the compiler instead
i think imma just give up and just make a new project tbh
when making a plugin for 1.8 server
should i use 1.8 spigot api
and what java ver should i use
well when making a plugin for 1.8 you can't use a newer api lol
you have to use the api version that is the same as that you are trying to support
so lets say the plugin will work on MC 1.10 and 1.8, well at most you could only use api version 1.8 because 1.8 server won't know how to use a 1.10, and the java version to compile with has to match with the lowest as well
in this case, java 8
alright thanks alot
How can I unfreeze the registrieries (net.minecraft.core.Registry#Frozen)
o.O
any way to disable this
you could provide Log4J a different profile to format logging
or you can capture the logging output and reformat it
Is there a way to move a player with a Spigot plugin in a Bungecoord network?
player message channel or whatever its called
send a message to the proxy and handle it with a plugin there
there is various ways to do this
easiest way is to instead use a bungee plugin
because bungee has an api for moving players between servers
Other ways?
make the player invoke a command
Ahh okay
Because I have a queue server and need to move them from this server to a other
Can I detect with a Bungeecord plugin when someone joined the queue server?
yes
Ahh okay then this will work
bungeecord knows all the servers a player has connected to
bungeecord knows everything a player does
nothing about the server though
except the address
hello , is there a way to check if player get items from chest ? and check how many items ?
i open a chest , i find 1 ender eye , i get it , and like so , till i get 8 ender eye in my inv
.
I might go to sleep , if anyone think of a way , dm me , or mention me 😄
When I get the PostLoginEvent from a Bungecoord plugin and try to get the name like this from a server:
event.getPlayer().getServer().getInfo().getName()
Would be this the name?
do you see the T broadcast?
Yeah mate
There is nothign wrong with your pdc, other than you write to it twice
in getMythicRune
Ah yeah i do i got told i had to set meta after again, forgot to take that out
other than that there is nothign wrong
instead of calling remove try setting it to null or it's amount to zero
Is there some way to unfreeze mojangs Registry objects?
- Don't
why not
What do you want to do with the registry
register items and blocks
Does bungeecord also has somethink like a BukkitRunnable?
To run something every 5 seconds
Mhm. So when the client receives these blocks and checks it's registry for them what happens
Hint: kaboom
I think shit happens WAAY before that
but i saw some premium plugins do this
Something like that
You'll have a mismatch between the material API and the block/item registry, so without ASM you can't do anything
Yes, they cheat
Yeah, they cheat
For blocks you simply "kill" other blocks, for items you set some metadata to set the texture
do you mean itemsadder
they use other blocks and retexture them according to block states
but you can register custom entities with bukkit api
no with resourceKeys
Without using javaagents or the instrumentation API you can't exactly do that without big explosions happening everywhere
anyway there apis doing it entitys why not with items?
My little UnsafeValues#processClass hack does not work for bukkit classes, so there is no traditional way to do that
while you can register custom entities, the underlying entity base isn't custom it is an already existing entity
the only thing that is really custom, is their logic in what they should or should not do
net.minecraft.item.Item
I guess you could using sun.misc.Unsafe to change the internal array of Materials, then proceed to use even more sun.misc.Unsafe to change up the Enum values cache in java.lang.Class and then unfreeze and re-freeze the NMS regestries through Reflection and sun.misc.Unsafe
TLDR: Without sun.misc.Unsafe or some way to transform classes you won't go anywhere
never recommended to mess with unsafe lol
doing it anyhow now
Hey when I'll try to move a player to a different server is there a way to check if the move was successful?
check if they exist on said server
Okay.
if they don't well it wasn't successful lol
Good luck, this will be fun for you
Btw is this the server name?
If you want the easier route, use the proper APIs
Can't wait for the errors tbh
watch them leak all kinds of objects
Kaboom!
Well I just think they'll forget to set the java.lang.Class enum cache
Which will have an incredibly subtle effect
regardless, a lot can easily go wrong with unsafe
could you also use mixins to modify the bootstrap methods?
Use forge if you're this dead set on it lol
There is no mixins
Unless you use javaagents that is
just remember, nothing in unsafe is guaranteed
It is safe to assume that Java 17 is going to stay around for longer than the current material API
that isn't what I meant
just that how stuff works in there is not guaranteed to be the same between systems
pft, who cares about OpenJ9
To be fair doing this sounds really fun, it's a shame I don't have enough time to try that out
Kk
Error: https://hastebin.com/ixujexeqed.properties
Does I need to use a other event for checking something like this?
@EventHandler
public void onJoin(PostLoginEvent event) {
if(event.getPlayer().getServer().getInfo().getName().equals("lobby")) {
}
}
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Thats a bungeecord plugin yeah
never worked with
I want to check if a player joined the lobby server and then add him to a queue
and after this move him if he is the first place
is there an op state change event?
there isn't afaik
just checked jds, dont thinkt here is
you can probably loop over Server#getOperators every x seconds/minutes and check if there is anything unusual
when a player logs in, they haven't joined a server yet
there should be an event for when they do join a server
?jd
from the dosc
postloginevent says this
Event called as soon as a connection has a ProxiedPlayer and is ready to be connected to a server.
so that means they haven't joined a server yet
that event is when the proxy has determined which server the player is going to connect to, but still hasn't connected to it
this one is for they have started connecting to it, but haven't logged into the server just quite yet
Already got if fixed
But thanks.
@EventHandler
public void onDamage(EntityDamageByBlockEvent e) {
Player p = (Player) e.getEntity();
e.setDamage(0);
p.setHealth(20);
e.setCancelled(true);
}
Does someone know why this is not working?
Players are still getting block damage.
anyone?
depends on what the block is that is damaging them
Barrier
i want to do a check for when i get 8 of ender eye
That's possible?
You might want to check the damage cause instead tho.
Yeah it is
Maybe use EntityDamageEvent too.
what event should i use for , lets say open a chest and get items from it ? xd
barriers shouldn't cause them to take damage, if anything knockback?
It's kinda tricky, but I guess you can use InventoryClickEvent.
Its because you drive with a train through a wall of Barrires
Check for suffocation damage cause.
yeah
also, if the barrier is indeed causing damage, then only thing I can think of is that it isn't treated as a block but instead as an entity
suffocation damage is only under EntityDamageEvent as a damagecause
Hello, thanks for answering i was thinking another prespective maybe , run the code when the chest is closed?
do you think this can work?
do i need the runnable?
why not listen for right click on a chest
not exactly sure what it is you are trying to accomplish though
IE, the over all goal
event.setCancelled(true);
System.out.println(event.getSlot());
if(elements.stream().noneMatch(element -> element.getSlot() == event.getSlot() && element.getClickEvent().isEmpty())) {
return;
}
StaticElement element = elements.stream().filter(e -> e.getSlot() == event.getSlot()).findFirst().get();
element.getClickEvent().get().accept(event);
Context: I have an InventoryBuilder that generates a custom inventory containing Elements. To allow these elements to perform actions, in the config you can set that
Elements:
12: //Slot
click-event: {ACTION-ENUM}
and as the inventory is loaded, for each Element containing an action, a specific Consumer<InventoryClickEvent> is assigned.
This code is inside the event that the consumer consume and checks for a relation between Bukkit Slots and Element Slots to get a Element Object.
Would you have any better ideas?
iam trying to , check when a player get a eye of ender itemstack , 8 of them , in his inventory , it should execute a code
and only applies if they pull them from the chest?
yes
You might be need a runnable check, perhaps?
then using the inventoryclose event as long as you check the inventory being closed is the chest, your code should work then
As they might get it from item drop maybe.
well it works for chests too, but it is hoppers and the like that invoke that event
not players
hoppers can pull items from chests and put items in chests
why would you?
you can get the player involved with the event
and as long as the inventory being closed matches the chest, then you can do a check of the player inventory to see if they have those items
if so, run your code
alright thanks , will try it out
iam adding , some quests from big servers , for skywars :
that's what iam trying to do
Inspired by *
does it matter where they get the ender pearls?
well its your code, so you should know
you shouldn't be copying other works
you should be doing things your way
not how someone else has it
iam just trying to know the best of aproching it
alright, if it doesn't matter where they get the pearl then you should change up your approach so this is optimal
I'm not sure what's best but these are the way that I can think of, so either listen to all event that involves in adding items into the player or a runnable that checks player inventory every x seconds.
how can i make an enum like CustomItem.ITEM that returns an itemstack?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/enchantments/Enchantment.html its made like this
declaration: package: org.bukkit.enchantments, class: Enchantment
hmm that looks bad for server xd?
frostalf
could you help me pls
make a traditional for loop and save half the hassle
Hello, I made a custom block that copies the block you place it on. But basically when you place the block on a non-solid block like grass or snow… it can’t copy it so it prints an error. How can I prevent this, is there a check for non solid blocks, because I don’t want to create a 100 lines array with all the non solid blocks?
Material#isSolid
isOccluding?
Is there a way to load a non-default world?
say in onEnable i want to load the world in the folder 'world_duels'
I’m gonna check, I hope that works
you can just use the worldcreator and "create" a world with a given name
ok ty
nice bugs with my java.nio.charbuffer impl
for some reason it transforms to 120+8+4
🤡
I'd rather say 128 + 4
i.e. it skips the -
changed it and found the issue
it doesnt skip the - ig
me changing the whole impl and then it breaks ;-;
that might have worked, but do you know why if(event.getAction() == Action.RIGHT_CLICK_BLOCK ...) says true even when i left click a block or air
wait nvm
HashMap<String , String> hashMap = new HashMap<>();
hashMap.put(target.getName(), random + " " + args[1]);
Main.plugin.getConfig().set("Targhe", hashMap);
Main.plugin.saveConfig();
Main.plugin.reloadconfig();
If the player is already there it replaces the string that is already there. How can I make it add another string instead of replacing?
you wanna chain those strings?
Yes
use a stringbuilder
ok
do you want to add another string to kind of list tied to a player
or just append new string to the one that already exist
computeIfAbsent
this
or merge or smth
new HashMap<String, String>().computeIfPresent("player name", (k, v) -> v + " " + args[1]);
I'll try
mojang
IIRC paper re-write this
hm I dont think so
I've checked their github and the only thing I see regarding "locate" stuff is a new event
patch 0555
How to properly break a block after you change its block data with sendBlockChange for exemple the block by default is stone then it becomes grass; so when you break it with hands it'll just return to stone and magically break after 5s
sendBlockChange is a fake change. it only tells the client the block was changed.
Hello elgar
let me show you
Pointless video. I just told you why you get a stone block
Because it was never really changed
yeah but why does it break then
It will only break if you break it in code or the player does
when I break the block it breaks like it's grass
what I'm saying is how can I break it directly after the grass is broke
ConversationalAPI hand-made...
How can I unregister the AsyncPlayerChatEvent after the convo is ended?
(Prevent it from getting fired again with the same old data)
it breaks like grass because the client thinks it IS grass
this is what I do java block.setType(Material.AIR);
the server knows better so it drops a stone block
Elg
well it can be, just requires changing multiple things to do so
and you would have to change the nbt structure of the chunk file
but how can I make it break after grass is broken and not magically break after 10s
its not magically breaking, you are doing that
if i use a pickaxe it breaks instantly because a pickaxe can break stone
an example of how to exit out of a conversation
Player.getPlayerExact(name) what is difference Player.getPlayer(name)?
can I prevent the block from breaking if the player isn't not holding a pickaxe?
also sometimes players have nicknames
woah
You can do a lot with conversation api 😛
the way I use it, it puts them in a channel with the server
so that player chat doesn't clutter their screen
at the end it puts them back in the global chat channel 😛
Wait but... I didnt understand how you fire the event only once
like how to get them into the conversation?
?paste
each of the prompts you see are technically a class
I just didn't use separate class files
im really fucking up
https://paste.md-5.net/cibovezowo.cs
It fires the event infinite times
Should I unregister the convo class once it fires the first time?
The reason my event only fires once is because I am not making use of the player chat directly
I am making use of the conversation API
declaration: package: org.bukkit.conversations
this API has existed for quite a long time now since like 1.7 or 1.6 I think
fuck found my bug, i had a switch in a loop and instead of breaking out of the loop, i was breaking out of the switch
lol
lol
-- = +
How could I use MiniMessage inside there?
@Override
public String getPromptText(ConversationContext context) {
return Lang.CREATE_COMPANY__CONVO__SET_OWNER__CHAT_MESSAGE;
}
I can't even get the player instance
are you trying to communicate ;-;
ik lol
my code doesnt know yet
Math -- =+, ++ = +, -+= -, +- = -
This should work
@Override
public String getPromptText(ConversationContext context) {
Component[] messages = new Component[]{
Lang.CREATE_COMPANY__CONVO__SET_OWNER__CHAT_MESSAGE,
Lang.CREATE_COMPANY__CONVO__SET_OWNER__TITLE__TITLE,
Lang.CREATE_COMPANY__CONVO__SET_OWNER__TITLE__SUBTITLE
};
processMessages(player, messages);
return "";
}```
trying to allow things like x--y
context.getSessionData("player")
so at the beginning I set the sessiondata player
and then later on, I can do getSessionData
Yeah but, the "" thing could fire to the player an empty line
do you want it to fire an empty?
because you can detect empty messages and then not do so
I mean, look at this code.
Process messages simply sends to the player a title and a chat message (prompt) using minimessage
By returning "" I don't want an empty line to be printed
idk what minimessage
is
anyways, you can process the output before you actually send it...
as you can see with this piece, I evaluate the input even if there is none
smh found my issue, had to do appendOperator(Operator.SUBTRACTION) instead of directly modifying the tokens and forgetting to increment the pointer
now time to see what breaks next 🙂
ok it works
my always writing a class InputMismatchException while java has one
lets just rename it to SyntaxException lol
time to remove old code
should put it in its own package too
1 of 5 tests passes and 2 are creating a stackoverflow smh
yah
is there a way to debug tests tho?
i do attach debugger when it runs and then it crashes
Try out another JVM I guess
If JBR does not work I guess testing out OpenJ9 is a good thing, they tend to be a bit different
you would most likely need to attach a debugger to the java compiler to do so most likely since tests are not exactly in the runtime
hmm one of my tests keeps running forever
not entirely sure, as you really don't debug tests with a debugger lol
MiniMessages creates a Component object that can be sent to a Player (Audience) (It's like a Rich format)
Example: <bold>Hello</bold>
(You can also create Gradients with it)
All I want to do is to send that Component Instead of a String as getPromptText requires
By returning "", it sends an empty line
you could instead call a custom method to be returned
something like \n
which can contain your component
seems like its an old bug
that may never have gotten fixed lol
@Override
public String getPromptText(ConversationContext context) {
Component[] messages = new Component[]{
Lang.CREATE_COMPANY__CONVO__SET_DESCRIPTION__CHAT_MESSAGE,
Lang.CREATE_COMPANY__CONVO__SET_DESCRIPTION__TITLE__TITLE,
Lang.CREATE_COMPANY__CONVO__SET_DESCRIPTION__TITLE__SUBTITLE
};
processMessages(player, messages);
return "";
}```
Do you mean something like this?
I thought you didn't want to return an empty line?
or do you want to return an empty line?
I don't want to
I just want my components to be printed in chat
It sends everything as written*
and some empty line as Bukkit ConvoAPI logic
-1+1 works fine but whenever i do -1 + 1 it keeps blocking
the only place where im checking for spaces just does a continue in a loop 💀
time to debug manually
ok stop returning empty strings
hmm i think its because my tokenreader tries to read the character after 1 and keeps blocking on a space
getPromptText needs a return as string not null
That causes the problem
declaration: package: org.bukkit.conversations, class: MessagePrompt
use the appropriate prompt then
yeeeehaaaaa
never used it, I have no clue what it does
is it like a StringBuffer, but only for chars?
more like a ByteBuffer for chars
can be
brb, gotta pump some healthy tobacco into my lungs
easy fix
don't forget special characters
wouldn't it be easier to check if its a digit?
String accepted = "-+*/()";
for (int i = 0; i < inputExpression.length(); i++) {
char c = inputExpression.charAt(i);
if (c >= '0' && c <= '9') continue;
if (c >= 'a' && c <= 'z') return ErrorType.ALPHABETIC_SYMBOL;
if (c >= 'A' && c <= 'Z') return ErrorType.ALPHABETIC_SYMBOL;
if (accepted.indexOf(c) < 0) return ErrorType.UNKNOWN_SYMBOL;
}
Frost, I got a more serious problem...
Could you help me?
After a fail, the convo ends and when I restart it, it gets fired twice
use j8-util StringReader best libeary yes
and what would be the purpose of that
I currently have a GUI that has an item that can be clicked to queue a player into a game
what would be the best way to check that the item clicked is that actual item
i was using customised localised names in 1.19 api
but in 1.8 api there are no localised names
does it have parsing, like i have TokenReader::readDouble?
nah but you can do Double.parseDouble(reader.collect(c -> isDigit(c)))
ima add that parsing shit later
looping multiple times meh
im trying to optimize it as much as possible
it checks to make sure that it is valid
well i handle all default cases at the end of the switch
are you doing an AST?
I don't think you can really get more optimal unless you want to go down to character points
nah
bruh
still have to optimize my algorithm too, only refactoring the parsing now
is it that bad?
idk why you are doing it this way o.O
Wdym lmao
I'm trying to understand the best way to create an InventoryBuilder with Customizable Items who starts a convo inside it onClick and setups a Company to be saved in a MariaDB db
What do you mean with that
ok, that is fine, but like just close the inventory and invoke your conversation api
don't try to do it all in like one go
damn this looks ugly https://paste.md-5.net/toyoculaco.cs
I am already doing this...
player.closeInventory();
ConversationFactory factory = new ConversationFactory(plugin)
.withModality(false)
.withEscapeSequence(Lang.CONVO_EXIT_WORD)
.withTimeout(60)
.withFirstPrompt(new OwnerPrompt());
factory.buildConversation(player).begin();
Component[] messages = new Component[]{
Lang.CREATE_COMPANY__CONVO__SET_OWNER__CHAT_MESSAGE,
Lang.CREATE_COMPANY__CONVO__SET_OWNER__TITLE__TITLE,
Lang.CREATE_COMPANY__CONVO__SET_OWNER__TITLE__SUBTITLE
};
processMessages(player, messages);
conversation api bad
tiqhjeothjeoiytgkhqeoikhygnhngadhnaohn
whats your solution?
make your own
jhgwrosruihgwioruhjw
it isn't bad o.O
they are just doing it incorrectly is all lol
just deleted it 20 mins ago
frostalf can I please be in denial for once
lol
I made my own fully fledged tutorial system with full conversation
worked on that shit for 6 months
I have my own too
?paste
except I didn't need to make a conversation API
I saw it, wasn't impressed
I just used what was already there. Is that what you are in denial about?
Illusion, what do you suggest to make that convo fire once?
that you made your own without realizing the server already had an API for it?
the conversation api wasn't that good
and also it's just for... conversation
I made more than conversation
more then conversation?
Illusion??
I don't like your approach and won't really suggest a fix for it
you are like describing how I use the conversation API currently, it is all chained together until it gets to the final thing
yes but my tutorial isn't just "teleport, say x, teleport, say y"
it isn't centered around messages
So, whats your approach...
ConversationAPI are too bad and my own are even worst...
What would you suggest, please, please, please...
I'm stuck on there since yesterday
conversation api is good enough for what you need
It's still bad for my standards
but it should work
you gotta start somewhere
ah I get what you are saying now. Keep in mind the tutorial plugin I have was created a long time ago lmao
I created mine 2 years ago
still use it nowadays
like the message objective is just one of many
my tutorial system is really interactive
"Walk over to the mine", "Place this tower"
then it gives you a tower
"walk over to the next area"
then it makes a particle trail
mine was created Nov 14, 2013
that's just a very nice way of calling yourself a boomer
So, back to the problem
https://paste.md-5.net/esagomeram.java
Why does it fire twice? The event doesnt really end (Convo)
Technically a Millennial. But I am just letting you know how old mine is and why it was built around messages primarily lmao
yep plan to at some point
because currently it doesn't work for whatever reason
typical side project
yo
why don't you get it working first and understand the new API
before like trying to do some weird stuff with it
listen man with the amount of bumps you're doing I really can't be bothered
Really good idea
thank you
just fyi
modality means supressing messages from other stuff, not supressing messages from your convo
so like player chat etc
that is why I use in my plugin, modality true because I need the player to see the chat from the plugin conversation
I might make an actual chat suppressing system for my tutorial at some point
just a queue of chat packets
with like a 200 size limit
I won't look at tutorial plugin until I have updated mine
and then I can just add an urgent tag to whatever packets I send on my objective
this way I am not stealing ideas from you 😛
I'm fine with stealing ideas
I am not though
lmao
I still gotta work on my nms tutorial
like a full free course on spigot
so I get clout
@opal juniper have you seen the code for it?
for what, HoloAPI?
yes
No, but i am somewhat aware of the backstory
anyways it died because of armorstands
ye
but like the code for it is quite a bit
it doesn't just allow Holograms
it also allows other plugins to use holograms
mans got more waves than the local beach
imagine having a beach
I live like 5 mins away from a tourist beach
lucky
I hate the beach tho
I prefer the pool on the apartments next to the beach 😎
benefits of having contacts
and yes I occasionally bust out the telescope to look at chicks
chances to find a gf
When a player breaks a block that is over void in my duels world, it causes quite a bit of lag for the player that breaks the block. Any idea why this may be? This is within a system that stores players placed blocks to check if they can break a block based on whether it is new or not.
am a developer, 0%
nah just lighting updates for the player
find a nerdy gf
it's shitty but just update your server lol
i want my server to be 1.8 tho

😦
those don't exist
i want 1.8 pvp

they do
ok but are there any alternatives
they are rare
if i want 1.8 pvp
nop
they don't exist
I'm telling you
no one wants like
a minecraft plugin developer ™️
as their life partner
hell no
I have friends
that end up being my assistants
because I force em to code plugins n shit
and pay em more than minimum wage
just like
"ayo I know you starving, I got this project I don't want to do, I'll toss ye 80 bucks"
and make 200 out of it
just do some final touch-ups at the end
it's like being a pimp but instead of selling out girls you sell out your friendship
@echo basalt as a fix, could i stop all block damage events if its not a new block
therefore they will never break the block client side
no that sounds real stupid fr
why 😦
whys that stupid
no comment.
alr ill just put blocks under the blocks
I am a developer and have a wife lol
what do you mean 0%?
so yeah
that's plenty attractive
but just development is corny
What do you do? I make plugins for a living
Do you go outside? nah not really
sometimes I like to play it up and say I'm a Distributed Systems and Network Engineer ™️
there are plenty of people who have found GF's through MC
while in reality I'm writing plugins that can be run on multiple servers at once
and talk to each other
think that is how optic found his GF
@vagrant stratus did you find your GF through MC? or something else lol
just curious
I'd also argue that optic is in a country with a lot of technical people n all
