#help-development
1 messages · Page 168 of 1
I'd personally use x and dx, but it's a matter of preference
At least in math notation
you can switch Span with Delta
generally go for full variable names that indicate their function
var0, var1, var2 are useless compared to minX, minY, minZ
I just inlined it for the sake of inlining
x0 -> minX
x1 -> maxX, for example
sure you can inline it all but even x0 and x1 take longer to understand than minX and maxX
Well a cube is basically just two points in 3d space
So x0/x1 naming scheme makes sense - although one would say x1/x2 would make more sense, but this is programming world
if you're not validating your inputs at least abs(num1 - num2)
it should be bigger-smaller, not the other way around
unless you want negative nums
?
This have always worked and never have negative numbers
🤔
you might be abs'ing it
Yeah, you want max-min, not min-max
it works the same way
num1 - num2 & num1<num2 -> negative result
yES BECAUSE MY CUBOID IS WORKING
no need for an ABS
SORRY FOR CAPS
Yes, but beware that you add a value on it afterwards
THE CAPS KEY IS NOT RESPONDIA SHIT
It's still an offset of the value you add
So this is should be okay right?
uhhhhhhh
You have two options.
((max - min) / 2) + min((min - max) / 2) + max
anything else is wrong
yeh
(8 - 4) / 2 + 4 = 4 / 2 + 4 = 6
(4 - 8) / 2 + 8 = -4 / 2 + 8 = 6
Like I said (x1 - x0) / 2 + x0 is correct
as you're exclusively working within the [min, max] range
Even if x0 or x1 is greater than the other
No it is not
invert min and max and you get the same thing
sure the result is the same but the thought process difers slightly
I'm not gonna argue any further
It is my firm belief that it is stupid to make arbitrary constraints that do not serve a purpose in the model
Indeed how would i apply this formula? A = 6a² to getting the area for a square
A = 6*pow(a, 2)
wait where a and 2 come from?
A in this case is (x0 - x1) * (x0 - x1) * 6
that applied to x, y, z right?
(x0 - x1) and (y0 - y1) and (z0 - z1) should all have the same value - at least value-wise (the sign could differ, idk)
Since you are multiplying it with itself the sign is irrelevant though
In essence your A = 6 a² formula is A = 2a² + 2b² + 2c²
But since a = b = c you can say A = 6 a²
For a cuboid that cannot be applied however - only for cubes
You need to iterate over all entries of the hashmap then
It might be better to just keep another hashmap that does the reverse
List<QueueType> reversed = queues.stream().sort(ListComparator::compare).collect(Collectors.toList());
Also why not just prevent players from doing queuing in the first place?
List<Player> duplicateQueuedPlayers = new ArrayList<>();
Set<QueueTypes> queueTypes = new HashSet<>();
Set<QueueTypes> dupQueues = new HashSet<>();
myMap.values().forEach((queueType) -> {
if (!queueTypes.add(queueType)) {
dupQueues.add(queueType);
}
});
myMap.forEach((player, queueType) -> {
if (dupQueues.contains(queueType)) {
duplicateQueuedPlayers.add(player);
}
});
Only returns duplicate queues, not duplicate players
You likely can do it with a single iteration but that'd require keeping a seperate map iirc
for performance use a second map, otherwise do it this way
what are you doin
get the players that are queued to the same thing
ok
cool
Also, there is 0 reason to sort a hashset
I wouldnt complicate my self haha, just put a boolean called queued the game and look if it enabled/disable and do action/s
🤔
Yeah
you use a subtype
So if the QueueType is unique why not use it as the key?
Do beware that this assumes that hashcode and equals have been implemented correctly
oh i read "HOW"
Wait so if the queue is unique why is the player the key if you're checking for the queue?
then use QT as the key and a iterable of players(uuid) as the value
or wait if its an enum you can even use a enummap
public class Queue {
private final QueueType type;
private final List<Player> players;
// constructor here
// getters here
public static enum QueueType {
Archer, NoDebugg, etc;
}
}
List<Queue> queues = new ArrayList<>();
Player player = this.queues.stream().map(Queue::getPlayers).map(List::contains).first();
all of that is most likely unnecessary
So spoonfeed him LMAO
🥄
I hate that type of people that said its better and better my way and critice another helping, so just spoonfeed your fucked code LMFAO
Don't use streams for the sake of using streams...
Streams >>>> shity fors + ifs + elses + etc
😂
Yes, but you can't actually do what they want with streams
🤡
At least not that way
LinkedList?
Yes that would be the correct way
yea
linkedlist has easier methods
ArrayList cares the position while LinkedList not!
its just easier to deal with
Yes i prefer LinkedList tho
At the cost of not being random-access-capable
not in regards to their big O
Just use ArrayDequeue at that point
Ideally you'd have
Map<QueueType, List<Player>> backwardRef = new HashMap<>();
Map<Player, QueueType> mainRef = new HashMap<>();
public void link(QueueType q, Player p) {
backwardRef.computeIfAbsent(q, (ignore) -> new ArrayList<>());
backwardRef.get(q).add(p);
mainRef.put(p, q);
}
The rest should be easy to inferr
public void unlink(QueueType q, Player p) {
backwardRef.computeIfAbsent(q, (ignore) -> new ArrayList<>()); // Can be discarded if wanted
backwardRef.get(q).remove(p);
mainRef.remove(p);
}
public List<Player> getPlayers(QueueType q) {
backwardRef.computeIfAbsent(q, (ignore) -> new ArrayList<>()); // Can be discarded if wanted
return backwardRef.get(q);
}
Being the two other methods that I can think of that @gritty pebble might need
Anyways, I should really go to bed.
It should really be a Set of UUIDs, but for the sake of simplicity I am working with Lists of players
how do I detect when an entity moves
i just started changing all my code and i realised that entitymoveevent doesn't exist
i'm trying to make a second layer without passengers or teleporting (teleporting is too slow, and passengers just won't work in my situation)
why sometimes I cant import the bukkit stuff?
I tried to import the configuration from bukkit
but when I try, the bukkit gets red
it's a new project
worked
thanks bro
Start 1000 music discs at one time and make the person suffer
if you do that to something tagged as music it doesn't stop it, it just attenuates it a lot
Yeah it doesn't work in vanilla either I believe
an artist is composing music for my boss fights
it's pretty sweet
here's a sneak peek at the song for the halloween boss battle
gives me ghost buster vibes
what exactly am i doing wrong here?
private static final Pattern conversion = Pattern.compile("<[a-fA-F]{1,100}>");
public static String configCompiler(String text) {
Matcher match = conversion.matcher(text);
while (match.find()) {
Bukkit.broadcastMessage("TESTING");
String matched = text.substring(match.start(), match.end());
text = text.replace(matched, MobGens.getPlugin(MobGens.class).getConfig().getString(text));
match = conversion.matcher(text);
}
text = color(text);
return text;
}```
U could start by telling whats happening? Is there something not working, any errors in console
sorry
what is it supposed to do
no console errors, it just wont detect the string
My lord please don't get your config like that
so basically i wanna be able to do for example: <prefix> and it returns the prefix from the config
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
just for a test until i do the getter for the main class
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
getConfig().getString("prefix");
i know
i wanna be able to do <prefix> and it'll grab it
PlaceHolders
i tried to do it via patterns but its not working for whatever reason.
PAPI
btw I usally make something like this
public class DataManager {
private final Mainclass plugin;
public DataManager(Mainclass plugin) {
this.plugin = plugin;
}
private File dataFile;
private FileConfiguration dataConfig;
public FileConfiguration getDataConfig() {
return this.dataConfig;
}
public File getDataFile() {
return dataFile;
}
public void createDataConfig() {
dataFile = new File(plugin.getDataFolder(), "data.yml");
if (!dataFile.exists()) {
dataFile.getParentFile().mkdirs();
plugin.saveResource("data.yml", false);
}
dataConfig = new YamlConfiguration();
try {
dataConfig.load(dataFile);
} catch (IOException | InvalidConfigurationException exception) {
exception.printStackTrace();
}
}
is there any reason why the matcher isn't working correctly?
I dont know why you are doing all that stuff
Just use placeholders if you want to get the string %prefix%
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
"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.
if you declare the type of one thing as a map, you can change it to something else, like a linkedhashmap, easier than declaring it as a hashmap
functionally there's no difference i dont think
would it be easier to just store the games as a list, and loop through them and see if the uuids stored in there equals the uuids you're removing
if that makes sense
because thats the people playing the game
:what:
no, theyre trying to get the game from the players' uuids
.
something like
for (Game g : gameList){
if (game.getUUIDS() == uuidArray) {
game.destroy();
break;
}
}```
lol nice
Hey, how do you damage an entity, just out of no where. Something like Entity#damageEntity
There isn't a damage method
Hey, what's the nms Registry class for 1.12?
Trying to fetch internal entity id
There are no mappings 😔
for(Entity entity : Bukkit.getWorld("world").getEntities()) {
}``` I wanna damage them all
There is no
There is no damage method
Ohh, living has that method thanks. And yeah I'll take care of that Item part :D
Update: EntityTypes.b
How do I check what server an online player is connected to in a bungeecord plugin?
I just started making bungeecord plugins
How would I write a BungeeCord plugin that connects players to different servers with BungeeGuard? It seems to be blocking it, and I assume I have to pass the token. How do I do that?
btw what's the point for making fields a, b, c, d
same as methods w(), xy(), a() and so on
some kind of obfuscation?
yes
who made this
mojang in their server jar
or craftbukkit devs
or spigot devs
or maybe some other guys
@vocal cloud
@hazy parrot
?
So they basically obfuscated NMS?
Yup
for which versions tho
Until 1.17 where mojmaps came around
Nope it was all done by hand
All versions of Minecraft are obfuscated
We maintain our own set of mappings for methods and fields we use in CraftBukkit, though since then we've just made use of Mojang's obfuscation mappings in development
i never used that so idk
It's basically a reverse engineering tool
For those that are technically knowledgeable to apply it
It makes the jar a lot smaller by removing a lot of long variable names.
^ this is the reason they still obfuscate
so basically if you use spigot as dependency you have no troubles with using NMS or what
Some even have optimizations although I've never seen them in action
How would I write a BungeeCord plugin
In a LoginEvent for bungeecord plugins, how do I get the player that logged in?
NMS is going to be obfuscated at runtime beyond 1.17. Pre-1.17, some fields and methods are mapped
event.get
there should be getPlayer or getConnection
there is getconnection
that's basically the player information
does that return their uuid/name?
as far as i remember
mk
so basically how do you use NMS in a spigot plugin with no troubles
in 1.19
for example
You've a few options, though I personally advise use of a Mojang mapped jar that's remapped at compile time
entity pathfinder goals
thanks gonna read that
who ru talkin to
Nuker
mk
you mean spigot jar with mojang mappings
built with buildtools
with a flag
BuildTools to get the server jar as normal, but while developing, use the stuff I linked above. It remaps NMS in your development environment, then obfuscates it when you build
what does this do
It's how pretty much all build tools do things. If you've ever worked with Fabric or Forge dev environments, they do exactly that ;p
basically builds spigot.jar
That will build a remapped 1.18.2 jar
so there are now two different spigot versions
one with mojang mappings
one without
which you can build with or without a flag on buildtools
In that sense yes. However, when building for production you do not want to use mapped
Since it can cause
licensing issues
mojang...
how would I teleport the player with this? It does not let me use event.getConnection.teleport(location)
but after that you need to change names to a b c d
and so on
so this thing runs on not-remapped server jars
am i right?
BungeeCord doesn't have spigot methods tho
oh
uh
so
how do I teleport them
is it not possible to make a plugin that works on all servers to teleport someone?
you need to send plugin message to spigot server
huh
and have a plugin on spigot server which receives plugin messages
oh
and when received teleports player
dunno how to do that
can you tell me or show me website that'll tell me
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ok
ig ima just do this on spigot and get to the server directly
one for spigot one for bungee
I was makin a bungeecord so I could run everything on 1 plugin for my server
thx tho
well bungee doesn't have spigot methods and classes
everything is for proxy
just thought they would have some mc things to do
yea
I thought I could still use minecraft events for it
like just different syntax
You can do some things through the proxy like open inventories and such. I've seen it before.
cool
never seen this
ima stick to spigot cus i already know a lot of stuff abt it
i mean
a little
more than bungeecord
You have to use packets through and through
use PostLoginEvent
so you can get ProxiedPlayer
and from ProxiedPlayer you can use this methods
but not teleport tho
How would I write a BungeeCord plugin that connects players to different servers with BungeeGuard? It seems to be blocking it, and I assume I have to pass the token. How do I do that?
what is bungeeguard
It's a plugin that patches certain vulnerabilities in BungeeCord, and it needs a token to be able to connect
Where can I pass that in?
Does it have API/Wiki?
It doesn't seem like it
p.connect(getInstance().getProxy().getServerInfo(get_config().getString("fallback-server")));
No, ServerDisconnectEvent
So when player disconnects you want him to get to fallback-server
Yes
doesn't this happen by default or smth
well what's the error
It kicks the player with "Proxy Disconnected"
Is server disconnect event called when player leaves or something
None that I noticed, it just doesn't connect you, but I'll check again
I might've missed that
Or when a server crashes
hmm
Wait a minute
It actually seems it was a ServerKickEvent firing
It's still the same connecting code, though
so with ServerKickEvent it doesn't work too
Because it isn't working on the server I wrote it for, just on my test server
I have no idea why
Hey guys I was wondering if any one had a tutorial on how to set up a bungee cord server on two computers?
how do I wait until a Bukkit Task is done before returning from a method
that pauses the whole server
I'm trying to wait for 20 ticks inside a method but I don't want the method to just exit before the 20 ticks have been waited
stuff with an action bar and making the letters appear 1 by 1
you know you can just put the rest of the code inside bukkit runnable
or use a TaskTimer
With some external booleans of integers for counting or checking for some conditions
which would stop the timer in the end
basically run a task timer and store it's id in a map with player as a key
and when player changes slot then cancel the timer
umm
Then no, you basically cant
unless you move the entire thing to separate thread
and call it's sleep()
would be non-precise tho
bad solution
I tried that and making it sleep still paused the full server
I tried to thread.sleep and outside it thread.join
to wait for the thread to finish before continuing but it still paused the MC server
you can send full code, maybe we can just suggest some improvements here
i'm not the only one guy alive rn
why not just schedule another task after 20 ticks
or am i misunderstanding
don't think that's what he really needs
haven't seen his code tho
this way he can just put the rest of the code inside the runnable
anyways gonna be executed in 20 ticks
for(char aChar : message.toCharArray()){
Thread thread = new Thread(){
public void run(){
try {
sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
oneByOne[0] = oneByOne[0] + aChar;
TextComponent textComponent = new TextComponent(TextComponent.fromLegacyText(oneByOne[0]));
textComponent.setColor(net.md_5.bungee.api.ChatColor.GRAY);
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, textComponent);
}
};
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
oh that doesn't have the thread.sleep in it
who knows
I am trying to repeat for each char, adding one to the full message each "tick" (20 milliseconds)
random thought: What if we made a yml -> html converter so we can write websites in yml like based people
and then joining it after sending the action bar?
you can just... use a scheduler
kys(keep yourself safe)
Never Thread#sleep on your server
❤️
it crashes stuff
yeah but that will cause the code to return from the method before the action bar is completed
part of me really wants to install BetterDiscord to hide these "1 blocked message" messages
CompletableFuture
You can sleep inside completablefutures
and to thenRun()
for new java only as far as i remember
blocked me for no reason lol
oops github down
wdym
yeah github seems to be down
oh
but
for you
it's very slow
it seems to be back
can't update my wiki page
works smooth for me
might be our dns honestly
unblock me, i literally did nothing to you
works fine for me but it's kinda slow sometimes
the finest dns a technician paid in bacalhau can afford
dns went on a smoke break
died of insult
github slower than magma's code what is this
doesnt work, discord changed typescript compiler and broke every plugin
loc = player.getLocation().add(0,10,0);
player.getWorld().spawn(loc, Fireball.class);
Few questions about this:
- How do I make the fireball always travel downwards and not wherver the player is looking
- How do I add a publicbukkitvalue to the fireball? (this case: "bedwars:screaming-bedwars-hidden-api")
no clue
but when I use /data the fireball comes up with that value
🤷♂️
same values as the f3 menu displays?
player.getWorld().spawn(loc, Fireball.class).setRotation(0, 90); ?
all pdc is stored inside of "BukkitValues" array inside of nbt
alrighty will do that then
actually
only lets me set direction
and that doesn't use my ints
When I run start.bat the normal spigot 1.19.2 starts too, anyone know why?
what
Oh sorry
any way to increase the strength of the fireball?
Anyone has any ideas for a project?
Question about brew time in brewing stands
What is the tick amount the progress bar compares to for progress?
Because it only allows you to set the time remaining
I wanted to make an if statement but in the isHoldingOwnLetter needs to get the player name, but when I try to put in the if (Player player), says that I can't instantiate
the isHoldingOwnLetter code
like, I just wanted to check the item in the player hands when he joins, so if it's his own Letter, just remove this from this inventory/hand
it doesn't work like that
public void onPlayerJoin(PlayerJoinEvent event){
Player player = event.getPlayer();
}```
check out the docs it will give you all the information on what methods spigot classes have
thanks
I am just starting sorry
ur g
OK, so default brewing time is 400
it's on the spigot website?
And this apperantly also determines the brewing animation
So is there a way to update the progress arrow without causing the bubble animation to speed up as well
now it's saying that I can't put the ==, but I will try to think here
it compares memory reference
strict is not the exact word
2 different objects with the same values might still return false
only reason why it might work with strings is because strings are pooled
equals, on the other hand, does some things
Memory reference matches? (a == b) -> No? Are both objects of the same class type? -> Do the hashcodes match? -> Are the values the same?
grr
Betta you do realize that they're comparing an ItemStack to a boolean right
smh my head
how do you not see it
it's right there
olk
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
Oh interesting
I never knew what commands this had
Sorry btw
(if I interrupted anything)
thanks, sorry to bother you, I am really starting with coding and I just wanted to do that, but I will try here
This place is pretty good for development questions
You can make a boolean to check for a certain condition relating to an itemstack but you can't compare it directly.
I haven't used much PDC personally, I keep using NMS with NBT tags but that's just my personal preference so I can use vanilla item tags with my plugin.
Nms is easy
Few hours ain't much
Remapped nms is basically raw spigot
You get rid of the wall that's hiding all the cogs
you could try .equals
did you get an error spammed?
then add more memory
The message says it ran out of memory
is there a way to get a more detailed description about what exactly filled the memory?
I attached the crash file above
what is yoru server startup flags?
my run.bat?
yes, the line that starts your server
give it more
I know 1GB is not a lot, but that never happened to me before and I wanna know what went wrong
it ran out of memory attempting to generate a chunk
your plugin / plugins are probably using too much memory now or too much chunk data has been loaded
easiest way to fix this without increasing ram is to delete everything and than repeat every single time you get this error
give it more memory and see if it fixes it. else you have a corrupt chunk/bad plugin
how much should I give it if it's just a testing server for my plugins?
just testing "shoudl" be fine on 1 gig
loc = player.getLocation().add(0,10,0);
player.getWorld().spawn(loc, Fireball.class);```
How to make fireball go straight down?
increase it and see if the error goes away
I give my testing servers 3 gigs per instance and my proxies 512mb
methods originally suggested didn't work
couldn't you edit its vector
and subtract y to send it downwards
set a vector to teh entity
^
on it boss
new Vector(0,-1,0)
anyone have any suggestions?
public static HashMap<OfflinePlayer, Double> sortVariables(String var_name) {
List<Double> doubles = new ArrayList<>();
HashMap<OfflinePlayer, Double> doubleHashMap = new HashMap<>();
List<Player> list = new ArrayList<>();
json.singleLayerKeySet("storage").stream().map(s -> s.split("::")).forEach(strings -> {
if (strings[1].equalsIgnoreCase(var_name)) {
String normal = strings[0] + "::" + strings[1];
doubles.add(json.getDouble("storage." + normal));
list.add(Bukkit.getPlayer(UUID.fromString(strings[0])));
}
});
Collections.sort(doubles);
Collections.reverse(doubles);
for (int i = 0; i < doubles.size(); i++) {
doubleHashMap.put(Bukkit.getOfflinePlayer(list.get(i).getUniqueId()), doubles.get(i));
}
return doubleHashMap;
}```
there has to be a better way of doing this
I have no idea personally.
Are you using a .json file to store data from a HashMap?
i mean, it works fine.
yes, but i wanna sort every variable
which everytime the player logs off it'll unload their variables
which is why im looping the json
Like how Skript stores data with variables?
yeah
but better
because skript doesn't unload variables, so it can cause memory leaks and high ram usage
yeah, and trying to make it faster
because i feel like this isn't that fast
and i can't test it because uuids
i mean, i could
but im lazy
I can't really help with that, sorry.
no worries
okay so this works BUT it also doesnt iygm?
https://imgur.com/a/k3PyKI3
white is the player
blue is where they are looking
and orange is the path of the fireball with that vector you mentioned
do you think the issue is that loc is the location of the player and therefore the direction they are looking? and that is also influencing the path of the fireball?
show code
That's the worst when that happens.
loc = player.getLocation().add(0,10,0);
player.getWorld().spawn(loc, Fireball.class).setVelocity(new Vector(0, -1, 0));```
amen
looks fine
no clue why that weird motion is happening then
What exactly are you trying to do?
tryna summon a fireball 10 blocks above the player that falls onto them
It is possible since location returns values such as pitch and yaw iirc.
anyway to fix that?
Have you tried just getting the position from the location?
Location contains XYZ, Pitch & Yaw so have you tried just getting the XYZ values and storing them in a new vector and using that instead of player.getLocation()?
Setting the velocity should be fine. it would overwrite any vector on the original spawn location
ima see if it gets the same effects if I just summon it right ontop of the player, if so, I'm fine with loosing the whole falling from above effect
oh my god
yes it does
okay
you can disregard my question. as of now I found a way around it
sorry about that guys
Describe better
no, you can run things async then run code sync but to return somethign you would have to lock up the main calling thread
dont mind the static abuse
damn, alr
Look up Futures
ty
Mechanics: clickActions: - conditions: - '#player.hasPermission("test.permission")' actions: - '[console] say hello <player>!'
Hi!
I am looking for a person to help me understand how to put in the ''conditions'' section a condition ( have 30 levels of exp).
Who can help me :D?
It work with JavaDoc
Anyone here
I have some problem
How to use armor stand to find rail and teleport minecart to armor stand
Are you trying to code this?
I mean how to save like that? just save the inv on pdc or how?
It's a default code for create condition for oraxen items
But need java docs attributes/ conditions
anyone know how to use gradle here?
https://pastebin.com/6chbtPWk
I want to make a script that automatically cretes 2 jar for me by changing defautPerm to either 'FALSE' or 'OP'
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(MinigameLib.getPluginInstance(), ListenerPriority.NORMAL, PacketType.Play.Server.REL_ENTITY_MOVE) {
public void onPacketSending(PacketEvent e) {
int entityId = e.getPacket().getIntegers().read(0);
if (nameTags.keySet().stream().anyMatch(en -> en.getEntityId() == entityId)) {
LivingEntity entity = nameTags.keySet().stream().filter(en -> en.getEntityId() == entityId).findFirst().orElse(null);
new BukkitRunnable() {
@Override
public void run() {
nameTags.get(entity).teleport(entity.getLocation().clone().add(0, 1.8, 0));
}
}.runTaskLater(MinigameLib.getPluginInstance(), 0L);
}
}
});```
not work
it lags behind
how do i make sure it doesn't lag behind (it's a nametag invisible entity)
without making it a passenger
you basically cant
why dont you want to make it a passenger?
because it will interfere with the regular customname
I have a project where I shade some smaller stuff into it and then i have a module that has it as a dependency, how to I make it so the module sees the bits as shaded?
i get the imports from before the shading
it's not what i want
When you compile the import should be correct in the compiled version
Hello, does anyone know how I can restore variables saved in mysql back to a .csv file? Because mysql stopped writing them.
uhh
it's for entitiess
not players
eh stil
and it's one listener for a manager
that listens for all registered entitiers
not one listener per registered entitity
?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.
Live the life of a thug - until the day I die
Live the life of a boss player
All eyes on me
All eyes on me
yada, you're not magmaguy
so you're not the correct person to answer
me rn: 🤡
Somebody knows?
Mechanics: clickActions: - conditions: - '#player.hasPermission("test.permission")' actions: - '[console] say hello <player>!'
Hi!
I am looking for a person to help me understand how to put in the ''conditions'' section a condition ( have 30 levels of exp).
Who can help me :D?
It work with JavaDoc
sounds like a #help-server question
unless im misunderstanding and you made the plugin using that configuration yourself
@tall dragon Maybe you know how to help me with it?
dont rlly understand the question
you want to export your mysql data to a csv file?
Yes, I do not know how to do this.
you would need to connect to your mysql database and run some query's
Unfortunately, it doesn't work like that, because after converting, it sets these variables somehow and the server doesn't read it.
i don't really understand what you're talking about
It just doesn't work the way you sent me
How can i synchronize two different GUI instances between each other?
i'm making a "trading" GUI in which both players put items on the left and the other player's items appear on the right.
how could i go about making this two GUIs work together?
maybe you should explain again what you're trying to do, and what exactly doesn't work
I'd create a "TradingInventory" class, that has two ItemStack[] fields. One for the first player's trades, one for the second player's trades.
Then create two inventories out of that, so both players have their items e.g. on the left side, and the other player's items on the right side. Then listen to the InventoryClickEvent and InventoryDragEvent. Whenever people change something on their side, also change the contents in your TradingInventory, and propagate the changes to the other player's open inventory.
or just decompile a trading plugin and steal half the src
bruh
That seems to be the best way to go about it
🤔
You probably want to implement your datatype, and use byte array to store (as items tack implements configuration serial it should be easy), someone correct me if there is better way
I wrote a library ( ^^^ ) that adds an ItemStack PDC datatype and also allows you to use lists, maps, arrays, etc
so you can just save the Inventory#getContents as PDC
myPdc.set(someKey, DataType.asArray(new ItemStack[0], DataType.ITEM_STACK), myInventory.getContents());
or just directly use DataType.ITEM_STACK_ARRAY
I forgot that this exists too
e.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, Integer.MAX_VALUE, 0, false, false, Color.RED));```
i saw this on the forums
to add a colored glow
but it doesn't seem to exist anymore
IIRC, the color parameter was only for the color of the bottle or something
not sure though
or the particle's color
sth like that
a plugin is using this method.
private static MyPlugin plugin;
public static MyPlugin getInstance() {
return plugin;
}
I am trying to get the instance of that plugin by MyPlugin.getInstance() and it returns plugin is null
so how can I get the instance?
you never assign any value
private static MyPlugin plugin;
{
plugin = this;
}
public static MyPlugin getInstance() {
return plugin;
}
do it like this
plugin = this; seted onEnable
does the
{
plugin = this;
}
get called for every new object? never seen it used
Yes
Its called the „init block“
Its like a „universal constructor“
It basically gets added after every normal constructor
So you can put stuff there that all constructors share
understood 🙂 thanks
That works too but i prefer the init block since it runs before onLoad
Still can't access the instance from other plugins
Then you seem to access it before your plugin instance got created
Add your MyPlugin as depend in your other plugins plugin.yml
Send your latest.log pls
getConfiguration() is null, NOT getInstance()
is there a way to show hardcore hearts
when a player is in the game
and remove/add them at any time
I can't access the instance & config. they both are getting in same way
and my main plugin load before the 2nd one
what's your other plugin's code?
just get some string
from main plugin's config
but it try to get the value from main plugin's config onEnable
idk is that the problem
are those fields? or is that in your other plugin's onEnable(), etc?
as said, if I was you, I'd set those values in the init block.
private static MyPlugin instance;
private static MyConfiguration config;
{
instance = this;
config = new MyConfiguration("filename.yml", this);
}
onLoad might be too late if you access it before onLoad gets called
onEnable
does YamlDocument.create() maybe return null?
do System.out.println(config) after you called YamlDocument.create()
see what it prints
if it doesnt print null, but still returns null from the other plugin, then it seems like you're accidentally shading your main plugin into the other one
My bad. I forgot to set scope provided 🤦
btw, thanks for help :)
np!
accidentally shading the other plugin is probably the most common mistake people do lol
it's Imajin now
or using build artifacts and then wonder why they get ClassNotFound
me using shadow knows by accident and wondering why my jar didnt change
that was me as a kid 'compiling' my code by renaming .java to .class
and just pasting it into jars
praying it worked
(it didnt)
Is there a way to get the recipient of a packet?
ie. Get the receiver of a ClientboundPlayerChatPacket
I basically just want to get who the packet is being sent to
ugh where did you get the packet object from?
usually you create the object and then directly send it
I'm intercepting packets in-order to log them but I need to know who the packet is being sent to.
so you do have a PacketListener right?
I have a system to listen to packets, yes.
PacketListener has a method getConnection(), which has a public field "spoofedUUID" which should yield you the UUID of that player
Alright, I'll try that.
the UUID could be wrong in certain cases though, e.g. when a cracked player tries to join in the PreLoginEvent or whats it called
but on online servers, after they actually joined, it should always be correct ofc
If it's incorrect, the person would just be breaking their own experience at that rate.
i think the issue is other players breaking other player's experiences by spoofing their uuid
I think the issue is people running offline mode servers 😛
The only time I ever use offline mode is for multiplayer testing on my own PC. (Local basically)
Just because I don't own two accounts so..
I am planning on running one once I finish coding it
If you don't mind me asking, why offline mode?
Fair enough lol
Also using a static singleton is just bad practice. Dependency Injection is the way to go
I dont really care about whether they bought the game or not if they want to play they can
but I will definitely force them to first solve a captcha through a website first
well there isn'T really much of a difference between
MyPlugin plugin = MyPlugin.getInstance();
and
MyPlugin plugin = (MyPlugin) Bukkit.getPluginManager().getPlugin("MyPlugin");
or is there?
player.sendMessage(boat.getVelocity())```
anyone know why this doesnt return anything?
velocity of boats is always 0, at least thats what I heard
I'm talking about dis shit
fun
yeah, me too
thanks
how else would they get their plugin instance from another plugin?
From another plugin?
yes, they have two plugins, and one accesses the other
the problem why it didnt work was because they shaded "MainPlugin" into "otherPlugin" so "MainPlugin.getInstance()" was always null 🙂
nope
well I have
but its not public lol
it's only part of AngelChest Plus
damn it I have either covid or bronchitis and I dont know yet because its too early wait dis da wrong channel
It says that spoofedUUID is null for some reason.
oh i see
in what packet? are you trying to get the UUID in some kind of "login event"?
I also think so
DI is just a pain in the ass and doesn'T really provide any advantages for stuff like spigot plugins
public class MyListener implements Listener {
private static final MyPlugin plugin = MyPlugin.getInstance();
using DI instead yields no advantage imho. MockBukkit exists 🙂
I'm trying to get it if the packet is a ClientboundPlayerChat packet.
RegisteredServiceProvider
weird, that should have a proper UUID
I honestly hate seeing the static keyword outside of constants and utility classes
Does offline mode affect it?
i dont know anything about offline mode
How do i send a data via bungeecord message channel?
I just saw how to read those message but how do i send it via bungeecord plugin?
offline mode uses uuid v3 (name-based) uuids
less secure as you can just send any name and it will generate the same uuid
It also doesn't contact mojang's auth servers which allows for cracked players to join
I'm using offline mode for local testing since I don't own a 2nd account.
you can just be based and have friends
My server isn't public so..
have a 128gb dedicated machine with a ryzen 9 5950x dedicated for testing
and maybe dynamic instancing :)
hetzner?
Barbaric overkill dialled up to 11.
because I got the same lol
yes
with the based 8tb nvme storage
:jealous:
or 16tb I don't remember
I got 2x3.84tb
pretty sure we're running the ax101 or something
got the test network and the dynamic instancing for live
All I need is the dynamic controller and the test network honestly
I can just get more dedis for instancing
Also has redis and mongodb pretty sure
How do i send a data via bungeecord message channel?
I just saw how to read those message but how do i send it via bungeecord plugin?
player.sendPluginMessage(plugin, byte[], string)
or pretty sure there's like
ServerInfo#sendPluginmessage
damn how much does that cost
month or months
is there a packet to undo packet made block changes? or should I just send one of the same packets with what the server has at that position?
just send whatever block data is at the location
how to damage an entity using entitydamageevent?
if i do that i cant damage the enderdragon
:/
to create a sign with text on it using packets, would I send the PacketPlayOutBlockChange packet with the PacketPlayOutUpdateSign packet?
watch out they say that if you ever start using imillusion's code before you know if your entire project is refactored into one massive enum class
enums are nice tho 😔
last one out throw a molotov
you're lucky im not russian or I would've drank it
how to make custom entitydamageevent to damage entity?
??
liek
Events are reactions thrown when some action is taking place
event doesn't do anything itself when caught
You basically need Entity#damage(value);
EntityDamageEvent damageevent = new EntityDamgeEvent(entity, DamageCause.Custom , damage);
Bukkit.getPluginManager().callEvent(damageevent);
something like that
i cant damage enderdragon if i do Entity.damage(value)
bcs no source i think
but if i add source then the damage that is demanded doesnt work
do i subtract health from the entity??
it should work tho
if not try just setHealth(getHealth() - value)
i tried
doesnt work
works for every other entity justs not enderdragon
Hardcoded dragon 🙂
:joesus:
does enderdragon count as living entity still?
cause then i might be able to fix it
declaration: package: org.bukkit.entity, interface: EnderDragon
try EnderDragon.getParts().get(0).damage(value)
EnderDragon.getParts().toArray()[0]
u cant damage still
How would I be making a custom achievements? I tried to search and found only libraries and I'd prefer to only use spigot library if that's possible
talking shit behind my back
I literally told you
Ender dragons are built out of parts
you can get the parent dragon from any part
I'm trying to talk shit in front of you, it's not my fault you have a dumptruck ass so large damned near everything is behind you
alright time to play everyone's favorite game, updating old configuration formats into new configuration formats
haha converter go brrt
he's making butt noises again
Hello, I run a server in minecraft. Skript is connected to the database in configu.sk and it crashes because it writes variables once not. And I mean, does anyone know how I can restore the variables from the database back to the .csv file as it was in the default config? Below I present you the bugs from the console
skript
Please can anyone help me?
Well first, #help-server
But also, looks like your Skript version expects 1.9+ and you're on 1.8.8.
127b + 1 going to -128b 🤔
yeah?
Why don't you want to use a library?
You talking about like player leveling or just when someone breaks x block they get a message and get it displayed in a menu?
or a reward
I want this to appear to the player as a normal advancement.
Like when you press L and see your advancements
And also a message when unlocking it
I said that I prefer not to
give material.WRITABLE_BOOK or smth
I think he means opening the "inventory"
boys I have found the true meaning of life
the search is over
the meaning of life is finding excuses not to update old config formats into new config formats automatically
the meaning of life is finding excuses
what is copilot tho
ai code help thing
lol
worst explenation ever but whatever
still have not used that
this shit #help-development message
how can i spawn a specific block break particle? For example bamboo breaking particle
world.spawnParticle i guess
yeah but how do i spawn the specific bamboo one
there's only BLOCK_BREAK particle
i guess some kind of data
if you need a better way of doing this lmk
idk actually but I guess it's step.. something
not a great help
private void updateOldStringFormat(List<String> oldList) {
List<Map<String, Object>> parsedObjectives = new ArrayList<>();
for (String questObjectiveEntry : oldList) {
Map<String, Object> parsedEntry = new HashMap<>();
String[] individualEntries = questObjectiveEntry.split(":");
for (String keyAndValue : individualEntries) {
String[] keyAndValueArray = keyAndValue.split("=");
String key = keyAndValueArray[0];
String value = keyAndValueArray[1];
}
}
}
oh yeah this is a goooooood start
can you guys feel how much fun I'm about to have
hey guys
what's the difference between mojang server.jar and craftbukkit version
can't you like code something for mojang servers directly
does mojang server support some kind of plug-ins
Only datapacks
or you need to rewrite the core itself
You can use java agents, but eh
thanks
Mixins 🙂
Well
It all falls back onto using a modding framework
copyright is void if you do not enforce it
aren't spigot and craftbukkit kinda illegal then?
Or better said if you set precedence of something not being enforced
?
https://github.com/bukkit/craftbukkit likes to have a talk with you
I mean doesn't craftbukkit basically use Mojang server's code
Spigot also has the same commits on their repos
What


