#help-development
1 messages · Page 1775 of 1

it has to check that value and has to be at least x blocks away from a value it has gave before.
Can you give a concrete example?
yes
So like, if they need to be 5 apart
1st: 7
2nd: 6 (fails 5 away test from 7)
2nd: 13
etc etc
but from what I understand
Let’s say you roll in the first instance
34
then you want the next value to atleast be
x+34 or higher?
ok
wait
The first time the value was "540" then the value is "600" but as this is not 200 away (for example) it takes another number
Yeah so what I said
It is not 200 away from what?
Hmm yeah
Oh
Well keep track of all the numbers you've generated, when you generate a new number, make sure none of them are within 200 of the one you just generated
If they are, just generate a new number and repeat
are you trying to generate random spawn locations which must be x blocks apart?
yes?
yes
do you have a specific area this has toi happen in?
i mean
Random random = new Random();
int x = random.nextInt(999999999);
int y = 100;
int z = random.nextInt(999999999);
i have done this
don;t show me code, just answer the question
sure
yep
not an area
ok, then stop using random to generate and instead use a grid
yes, using a grid all points will always be x blocks apart and you can easily calculate a new location and track any that have been used
what is this suppose to mean
[15:20:34] [Server thread/INFO]: com.splyfof.splymain.ItemsJsonReader@9eaa91
the @ part
then why is a constructor in the main class never used?
try (Reader reader = new FileReader("splymainitems" + File.separatorChar + filename)) {
ItemsJsonReader itemsjsonreader = gson.fromJson(reader, ItemsJsonReader.class);
getLogger().info(itemsjsonreader.toString());
System.out.println(itemsjsonreader);```
which class are we talking about specifically
The part after @ is the memory address
the class extending JavaPlugin
That string is printed since you haven’t overridden ItemsJsonReader::toString
It is used
it does tho
oh never saw it
It’s just not used at compile time
hmm
Which is why the compiler might mark it as unused
how would i do that lol
Try adding
public String toString() {
return "blah";
}
In your ItemsJsonReader
You’ll recognize a change
Then work it out from there I suppose
that toString should make it a string tho right?
hmm
It should represent an instance of the class in a mere string
Not automatically
You’d have to return name; in toString
ahhmm
i thought it was gonna show something like this
Staff{name='mkyong', age=35, position=[Founder, CTO, Writer], skills=[java, python, node, kotlin], salary={2018=14000, 2012=12000, 2010=10000}}
String.format 
return "{name="+this.name+"}"; in toString could achieve that
the guide i was following was totally different so probably that
Well I mean are you trying to deserialize and serialize stuff into/from json using Gson?
MoreObjects.toStringHelper😎
Lol what library is that
Guava
Interesting, never heard of it 👀
I saw MoreListeners
heh i cant call super.onTabComplete(...) when implementing TabExecutor
well, google lmao?
uwu
Is it possible to flip the direction of a powered furnace minecart without using NMS?
ItemStack be like
like BukkitRunnable or something
?scheduling
Wow
okay so guys
i found out how to repeat a task
but now i dont know how to repeat the task i want
right now its just spamming "this is a repeat task" in chat
remove the logger i guess
Btw in how much time u repeat the task?
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage("this is a repeat task");
}
}, 0L, 20L); //0 Tick initial delay, 20 Tick (1 Second) between repeats
``` yeah but how do i put the task that i want it to repeat in it?
yup ik thats what i want it to do but idk how to put the task i want it to be in that
well let me say what i want to do first so you can understand
Well i don't know even what do u want to do.
so i made a scoreboard but its not updating so i think to update it every tick then i need the repeat task but now idk how to put the task inside the repeat scheduler
Do u want to do a task for that?
//Updating the scoreboard
private void updateBoard(SternalBoard board) { //SternalBoard it's my api
List<String> lines = core.getConfig().getStringList("settings.scoreboard.lines"); //Path
lines.replaceAll(s -> PlaceholderUtils.sanitizeString(board.getPlayer(), s)); //Papi parse
board.updateLines(lines);
}
}
whats this
//Update tasks > 20
public void init() {
taskIds = new Integer[2];
if (core.getConfig().getInt("settings.scoreboard.update") <= 0) {
core.getConfig().set("settings.scoreboard.update", 20);
}
if (!core.isAnimationEnabled()){
taskIds[0] = (core.getServer().getScheduler().runTaskTimerAsynchronously(core, () -> {
AsynchronousFileChannel file = (java.nio.channels.AsynchronousFileChannel) AsynchronousFileChannel;
for (SternalBoard board : this.boards.values()) {
updateBoard(board);
}
}, 0, core.getConfig().getInt("settings.scoreboard.update", 20))).getTaskId();
if (core.getConfig().getInt("settings.scoreboard.update") > 0) {
taskIds[1] = (core.getServer().getScheduler().runTaskTimerAsynchronously(core, () -> {
for (SternalBoard board : this.boards.values()) {
board.updateTitle(PlaceholderUtils.sanitizeString(board.getPlayer(), core.getConfig().getString("settings.scoreboard.title")));
}
}, 0, core.getConfig().getInt("settings.scoreboard.update", 20))).getTaskId();
}
}
}
I think u want to do something like that
uhm yes but this seems complicated
U can see it, it's open source.
is there a way to send message through bungeecord to other server without having bungeecord plugin?
are you just showcasing your api-
Yep
how
Well, it's based on the api but u can use the Bukkit i guess?
ye im using bukkit rn cause i understand it a bit
but tell me how to put the task that i want it to repeat, inside it
Guys I realy need help https://pastebin.com/8sTb5WCa password: qeBztqjMvW
Use BungeeCord subchannel to send a message.
Well, what's the thing that u want to be updated?
when i did the same thing directly in phpmyadmin all works
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective obj = board.registerNewObjective("HubScoreboard", "dummy",
ChatColor.translateAlternateColorCodes('&', "&a&l<< &2&lCodedRed &a&l>>"));
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score score = obj.getScore(ChatColor.BLUE + "=-=-=-=-=-=-=-=-=-=");
score.setScore(3);
Score score2 = obj.getScore(ChatColor.AQUA + "Online Players " + ChatColor.DARK_AQUA + Bukkit.getOnlinePlayers().size());
score2.setScore(2);
Score score3 = obj.getScore(ChatColor.AQUA + "Total Mob Kills: " + ChatColor.DARK_AQUA + player.getStatistic(Statistic.MOB_KILLS));
score3.setScore(1);
player.setScoreboard(board);
Do u want to update the lines i guess.
yes
cause i want the Mob Kills to update every tick so it can show me what my actual mob kills is instead of just staying on 71
thank you
public void taskUpdate(Player player){
new BukkitRunnable(){
@Override
public void run(){
if(player == null){
this.cancel();
}else{
Scoreboard board = p.getScoreboard();
//Here ur stuff to update
}
}
}.runTaskTimer(Scoreboard.plugin, 0, 20)
}
oop
It's pretty much bet generate a config, and add a string to edit the ticks-check
eh
Nvm, if it's for you i guess that u will not edit it so much.
i dont understand what you mean but that
by that*
but uh that will repeat the scoreboard?
nonstop?
With }else{
Scoreboard board = p.getScoreboard(); u are getting the scoreboard that u created
Just will check all time the players.
As i said, u can see my plugin to "guess" how u want it?
Or using an api, that does that more easy.
public void createBoard(Player player) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective obj = board.registerNewObjective("HubScoreboard", "dummy",
ChatColor.translateAlternateColorCodes('&', "&a&l<< &2&lCodedRed &a&l>>"));
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score score = obj.getScore(ChatColor.BLUE + "=-=-=-=-=-=-=-=-=-=");
score.setScore(3);
Score score2 = obj.getScore(ChatColor.AQUA + "Online Players " + ChatColor.DARK_AQUA + Bukkit.getOnlinePlayers().size());
score2.setScore(2);
Score score3 = obj.getScore(ChatColor.AQUA + "Total Mob Kills: " + ChatColor.DARK_AQUA + player.getStatistic(Statistic.MOB_KILLS));
score3.setScore(1);
player.setScoreboard(board);
new BukkitRunnable(){
@Override
public void run(){
if(player == null){
this.cancel();
}else{
Scoreboard board = player.getScoreboard();
}
}
}.runTaskTimer(plugin, 0, 20);
}
``` does it seem okay?
well uh i dont mind it
Well, seems fine.
Np, also check this https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/#forward
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
That works however it requires a player to be online
hm
it doesnt seem to repeat
i mean like im online and also killing mobs but it doesnt change
yea, googled it, thx tho
public void updateScoreBoard(Player player) {
Scoreboard board = player.getScoreboard();
I guess
just that?
new BukkitRunnable(){
@Override
public void run(){
if (player == null){
this.cancel();
}else{
Scoreboard board = player.getScoreboard();
}
}
}.runTaskTimer(plugin, 0, 20);
``` do i remove this then?
if (Bukkit.getOnlinePlayers().size() == 0) {
board.getTeam("onlineCounter").setPrefix(ChatColor.DARK_AQUA + "0" + ChatColor.RED + "/" + ChatColor.DARK_RED + Bukkit.getMaxPlayers());
} else {
board.getTeam("onlineCounter").setPrefix(ChatColor.DARK_AQUA + "" + Bukkit.getOnlinePlayers().size() + ChatColor.RED + "/" + ChatColor.DARK_RED + Bukkit.getMaxPlayers();
}
Using the team
Score score= obj.getScore(ChatColor.translateAlternateColorCodes('&', "&a&l<< &2&lCodedRed &a&l>>"));
score.setScore(3);
Team onlineCounter= board.registerNewTeam("onlineCounter");
onlineCounter.addEntry(ChatColor.RED + "" + ChatColor.WHITE);
onlineCounter.setPrefix(ChatColor.GREEN + "Online" + Bukkit.getMaxPlayers());
Score score3 = obj.getScore(ChatColor.AQUA + "Total Mob Kills: " + ChatColor.DARK_AQUA + player.getStatistic(Statistic.MOB_KILLS));
something like that lol
thanks
Maybe denied conexion?
Hello, how I can delete my resources?
my resources on spigotmc
He probably means in the resource section
ooh
plugins / resources on my spigot page
well i dont know that too sorry 😅
XD
np man XD why sorry?
Yeah well all we ask sometime
oh no
well uh
it doesnt show anything
Objective obj = board.registerNewObjective("HubScoreboard", "dummy",
ChatColor.translateAlternateColorCodes('&', "&a&l<< &c&lRiskyRay &a&l>>"));
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Team OnlineCounter = board.registerNewTeam("OnlineCounter");
OnlineCounter.addEntry(ChatColor.RED + "" + ChatColor.WHITE);
OnlineCounter.setPrefix(ChatColor.GREEN + "Online: " + Bukkit.getMaxPlayers());
Team MobKills = board.registerNewTeam("MobKills");
MobKills.addEntry(ChatColor.AQUA + "" + ChatColor.WHITE);
MobKills.setPrefix(ChatColor.BLUE + "Mob Kills: " + player.getStatistic(Statistic.MOB_KILLS));
it only shows the scoreboard title
how to make it visible
It’s hard to tell from that mere snippet of yours
oop
Would be easier if you showed the entire class or something
Also make sure you’re testing a newly compiled jar with the latest changes
well its combined with another code so dont mind it
If you have GitHub push it to a remote repo there
?paste
thats the whole class code
its combined with one of my other code so dont mind that
Send the 2 classes
2 classes?
Or well is that it?
uh thats all of the scoreboard
So what are you trying to do?
to make the Mob Kills count update
Cuz right now it looks somewhat like a mess
because i want to make like a mob kills count that can show players how many mobs they've killed
but it doesnt seem to update while theyre online
Ah I understand
First of all
You probably want to map a scoreboard instance to every player online, and not setting a new one for every player once a player joins
Yeah I guess I can walk you through, 1 second
First of all let’s do it from a new class, such that we can isolate the scoreboard logic itself, okay?
okay
public class ScoreboardRepository {
public void add(Player player) {
}
}``` something like this is probably enough for the time being
you might notice it won’t do a jack shit as of now
yup i see that 😅
But if you want, you could go ahead in main class and do smtng like
public class FancyMainClassEpicStuff extends JavaPlugin {
@Getter
private final ScoreboardRepository scoreboardRepo = new ScoreboardRepository();
@Override public void onEnable() {
this.getServer().getPluginManager().registerEvents(new WelcomeListener(this),this);
}
}
//then in WelcomeListener you probably will have something like:
public record WelcomeListener(FancyMainClassEpicStuff plugin) implements Listener {
@EventHandler public void onJoin(PlayerJoinEvent event){
Player player = event.getPlayer();
plugin.getScoreboardRepo().add(player);
}
}```
Now let’s continue the repository class
wait
uh
im tryna understand what you want me to do with this code here gimme a sec
The first class is your main class, which basically instantiates/creates an instance if ScoreboardRepository, then we expose a getter (which can be done without Lombok, and is probably what you should do)
so i gotta put the code
@Getter
private final ScoreboardRepository scoreboardRepo = new ScoreboardRepository();
@Override public void onEnable() {
this.getServer().getPluginManager().registerEvents(new WelcomeListener(this),this);
}
}
``` in my main?
How does your main class look right now
Send it, I don’t mind
is it better to use reflection or create modules for each version for NMS?
Okay ima jump on my pc 1 sec lol
oop lol
I like to use proper oop and use modules since you get compile time checks
But the performance difference is negligible
Especially in later versions
Of course with the assumption that you cache the reflection instances you obtain
ok
my main is messy lol
also idk how to put my recipes in one class instead of them out in the open at the main
lol
yuh
okay im on my school laptop now lol
but anyways
you could just extract the recipe logic out from the onEnable method in another method
Block block = p.getTargetBlockExact(5);
Material smoker = block.getType();
if (smoker == Material.SMOKER) {
p.getInventory().removeItem(malzeme);
p.closeInventory();
if (block.getState() instanceof Smoker) {
Smoker f = (Smoker) block.getState();
f.setBurnTime((short) (20 * 60 * 2));
}``` guys this is not working why?
I am setting the furnace burning when I did something
yuh ^
anyways the
public void setupRecipes() {
//the code
}```
is just the definition of a method/instruction
we then of course need to make sure that the instruction is read by our program
which is precisely done in onEnable
yuh
and void just means the instruction does something and thats it
if you were to replace void with for instance String it would expect you to once the instruction has been completed, return a string value
well if you're interested in that, I suggest googling a little about Java methods, and of course you're free to ask if there's something you wouldn't understand
anyways should we continue with the scoreboard?
are you using maven/gradle?
Yes
then you need to reload your project
oo
sounds delightful
ok
my school laptop is better than my normal one 
lol
open your pom.xml and click the refresh button on top-right corner if it is there
nope
not there
if there is no such button, please send content of pom.xml
i aint dumb i already clicked it once
why the fuck did i type kick
Actually, there is no com.andrei1058.bedwars.BedWars class, maybe you are search for com.andrei1058.bedwars.api.BedWars? though it is still weird cuz in my ide it works fine.
try invalidation cache via File -> Invalidate Caches, check all checkboxes and click Invalidate and Restart
???
??? ???
click "File" at the top-left of intellij, then click "Invalidate Caches..." then check all checkboxes and click "Invalidate and Restart"
nice it fixed
nvm didnt fix
its back
Can you do plugin.saveDefaultConfig() in onLoad() ?
Or might that cause problems?
Is doing it in onEnable() prefered?
You should be perfectly fine calling this onLoad
it doesn't interact with the server whatsoever
Just copies a file from inside your jar into the plugin folder
i cant call super.onTabComplete(....)
Not if the super method is an abstract method
^^
ah bruh
i thought you could call abstract methods
then how can i block the method from being executed
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) {
return (!isAuthorized(sender, permission) || !hasTabComplete || isConsoleSender) ? null : super
}
otherwise call itself (the method is overridden so)
this without stackoverflow
Bukkit.broadcastMessage("test");
}
``` anyone know why when i killed the entity it doesnt broadcast it...
are you sure it gets executed?
nvm i was thinking something else
but tbh id prefer a map
¯_(ツ)_/¯
I thought it was like materials to normal display name or smthing but i was wrong
Translatable components 😎
Hi, is it possible to trigger PlayerPortalEvent on a player manually (so he changes the world and a portal gets created/discovered)?
java.util.ConcurrentModificationException: null
i hate this bullshit
its not as if im using async operations
its due to the way i cannot delete something while iterating the same reference of the collection
so annoying
(iterators)
you can do iterator.remove()
but heck, i already a made public method doing that
now i need to make iterator version of it
disgusting
There's also removeIf
can somebody help please? I am getting this error craftsmoker cannot be cast to block.smoker
Block block = p.getTargetBlockExact(5);
Material smoker3 = block.getType();
BlockState state = block.getState();
Smoker smoker = (Smoker)state;
BlockData data = Material.SMOKER.createBlockData((blockData) -> ((Smoker)blockData).setBurnTime((short) 1));
p.sendBlockChange(smoker.getLocation(), (BlockData) smoker);
```
Hey, i just started learning java. So i thought i might as well make a plugin whilst learning to apply skills to something I might use in future for good practice.
I am juist wondering, currently I just installed Intellj IDE, for the JDK would I use java 16, the plugin is for a 1.17.1 server. I am not too sure which version to use, so I am assuming java 16 is the best version to use
Yeah
I mean soon Java 17 is probably the wiser choice between the two
But for the time being 16 or just 11 are both safe bets
how soon is soon tho
When more stuff surrounding the development of Java starts to support Java 17
For instance gradle, a popular build and dependency management tool for Java has recently added support for Java 17
Or when you want to use NMS in 1.18
That too
so im guessing java is very backwards compatible?
Sort of
i just started learning coding so idk too much
Can you guys see my message 😓
What do you want me to do, contribute or something, smh
Generally a java compiled class with the version x and a jvm instance with the version y, you’d get the version relationship of x<=y
How would one get the actual Item entities from a death, instead of the itemstacks?
I just want help :/
Don’t know if you can
that's a design flaw
BlockState and BlockData are not the same thing
What do you want the entities for
huh
is it possible to access the config files of plugin A from plugin B?
i ask this because i want to create a "manager plugin" or like a main plugin to controll my other plugins in my server
?java16
Install Java 16 at https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
sure, Plugin.getConfig is public
another way of askign this is "is it possible to access a config file with a given path?"
As is getDataFolder if you want to access other files
YamlConfiguration.loadConfiguration
Use something like adopt open jdk
aight im gonna try that thanks
does which JVM really matter or no
anyone know why this isnt working?
@EventHandler
public void onJoin(PlayerJoinEvent event) {
createBoard(event.getPlayer());
}
public void createBoard(Player player) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective obj = board.registerNewObjective("ScoreboardName", "dummy", ChatColor.RED + "" + ChatColor.BOLD + "<< " + ChatColor.DARK_RED + "Savage SMP" + ChatColor.RED + " " + ChatColor.BOLD + ">>");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score discord = obj.getScore(ChatColor.BLUE + "Discord: " + ChatColor.RESET + "discord.gg/aserver");
Score ip = obj.getScore(ChatColor.AQUA + "IP: " + ChatColor.YELLOW + "savagesmp1.minehut.gg");
Score divider = obj.getScore("");
Score statstitle = obj.getScore(ChatColor.GOLD + "" + ChatColor.BOLD + "STATS:");
Score mobkills = obj.getScore( "Mob Kills: " + ChatColor.DARK_GREEN + player.getStatistic(Statistic.MOB_KILLS));
Score playerkills = obj.getScore("Player Kills: " + ChatColor.DARK_PURPLE + player.getStatistic(Statistic.PLAYER_KILLS));
Score deaths = obj.getScore("Deaths: " + ChatColor.DARK_RED + player.getStatistic(Statistic.DEATHS));
discord.setScore(7);
ip.setScore(6);
divider.setScore(5);
statstitle.setScore(4);
mobkills.setScore(3);
playerkills.setScore(2);
deaths.setScore(1);
player.setScoreboard(board);
}
Fun fact, discord detects server invites in code blocks
lol
did you register the event
Oo they actually did, nice
um
no
lol
im dumb
i swear thats what happens half the time im here
i always forget to register
one day I'll port Minecraft java edition to xbox
just to prove what microsoft should have done
But performance!!!11
lol if you think bedrock performance is good
port it to ps5
I mean it gets high framerates / huge render distance if you just sit there
but aside from that, 💩
Give us @EventListener annotation kthx
Not sure that would work well with spigot due to people using a lot of dependency injection
idk how that would work
you'd need to include a whole dependency injection framework too
Hehe
is there a way to instant respawn the player without the death screen flashing for a split second?
What version
there's no gamerule in the ver im using
im so stupid, didnt even see the built in jdk installation for intellj
i thought of canceling the damage event if damage's fatal but then i'd have to handle the drops and the rest
yea exactly
was wondering if there was another way else than canceling damage event
Intercept the outgoing packet telling them they died maybe? Idk
oh yea that's a good idea too
i'll try
thanks
would they be in a state of perma death or something client side if i don't tell the client the player respawned tho?
totally agree. You can prove this just by looking how bad is TPS on ibxtoycat's world, while he's streaming or capturing vids.
playing minecraft on bedrock feels like you're having lots of latency issues
I don’t understand how
They basically got the chance to give minecraft the recode it needed
PlayerDeathEvent.getDrops() is a mutable list, right?
I feel like it is mutable, what do the docs say
nothign
Pretty sure it is
well C++ is great language for performance, its just that the code is not that great
I mean even java isn’t that bad
so getDrops.remove() should work, right?
if there ain’t a set blocks, it’s mutable
java is great lol
At least java has an excuse, 11 years of code from several different devs
But bedrock doesn’t have that excuse, because it was made from scratch afaik
I've worked in a lot of languages and Java would be my top one, with Pascal second.
well Bedrock is based on Pocket Edition, which was written in the early days (2011-2012)
True
I like that bedrock connects all these platforms
And from what I know it has some neat customization tools
But like, that’s about it
they could've ported java to all platforms
though the phones would be a bit difficult back then
Some dude on the team probably persuaded them Java runs poorly
but the consoles would've been ez pz
Impossible, only 3 billion devices run java
Bedrock is not great, not terrible version, but it really needs some polishing
i despise wiggly hands
on that version
it just looks weird
They have some good features but are also missing some good features
Mojang full parity plz
redstone is weird too
True
Mobs that are on fire looks different
Geyser it's more XD
But I want my moveable tile entities, and they want their banners on shields
Flying mode is really weird on bedrock too. On Java you have that smooth gliding effect whenever you stop holding WASD buttons, while on bedrock you stop immediately.
anyone know why this kinda flickers and any way to fix it?
new BukkitRunnable() {
@Override
public void run() {
for(Player plr : Bukkit.getOnlinePlayers()) {
createBoard(plr);
}
}
}.runTaskTimer(this, 5L, 5L);
you're creating scoreboard every 5 ticks?
wtf
5,5?
if i had to guess
ok
can't you just remove objectives
Also don’t create a new scoreboard each time
yeah
instead of just creating scoreboard every time
Update the prefix and suffix of stuff for a smooth transition
that way it wouldnt flicker
Good memory leak
Is everything regarding Scoreboard and ScoreboardManager thread safe?
Not a memory leak tho
Well, i think that yes
No memory leak is when garbage collector can’t collect an object even though it is dead with no references to it any longer
if i had to guess, no, since NMS has Scoreboard and ScoreboardTeam objects which are mutable
true
Then doing it async might cause issues
At least without making it externally thread safe
well all it does it sends the packet
Storing a player instance can cause a memory leak can’t it
If you don’t remove it on disconnect
Yes, since player objects on disconnect are stale
Yeah, well in this high abstraction, god knows when spigot decides to mutate something
Well that i said
On newer versions of NMS reflections for packets are useless
nNah
you can just instanciate it via PacketDataSerializer
I whould do something like this
public void removeScoreboard(Player player) {
SternalBoard board = getBoards().remove(player.getUniqueId());
if (board != null) {
board.delete();
}
}
Instanciate
edited my dear
In that same class, it's a very dumb thing on 1.8x at least
Instantiate
I took me lots of time to research PacketDataSerializer
since there's little to no info on google
and methods are obfuscated
by creating scoreboard every 5 ticks (5/20 second), you're sending packet back to the client, thus why it flickers
you need to modify your previous created scoreboard
ok
Even that will flicker
really
Hence why teams and prefix/suffix is used
so like return the scoreboard with the create scoreboard and then modify that?
By default the NBTCompressedStreamTools on PacketDataSerializer it's of 2MB and no server will use that, doing overflow/books exploits, i whould decrease it to 40000L no way u will use 2MB. At least on 1.8x (U avoid use "anticrash" plugins)
how?
noooo everyone knows you have to use nms and packets for scoreboards
<insert rage meme here>
so basically objectives are static while teams have some sort dynamicality on GUI?
Is it possible to import the default nether TravelAgent for spigot 1.12.2? I mean the one being used to create and find portals in the nether and back
it demands the TravelAgent from me
md5 why dont you have your github profile in your discord?
that's the docs for 1.12.2
I wonder what md even has on git
Why tho?
You could simply google it?
Md forks all the plugins
why are you making an event?
generally you shouldnt be doing that
maybe he has custom portal implementation
and wants to call that event to make integration with plugins easy as 1 2 3
As simple as do re mi?
yesn't
I want to instantly move a player on join to a created/found portal. I basically want to split the overworld and the nether to different servers and naturally switch between them
Wouldn't Inventory Sync plugin make this possible
It won't create or find a portal I think
on 1.17 it's much better, but I need it to work on 1.12.2
idk, 1.12.2 is too long ago
why wouldn't you go 1.13+
CraftTravelAgent.DEFAULT ?
Hey all, so I'm trying to give players with a certain PersistentDataContainer value some effects, such as giving jumpboost2 while the player is sprinting
I've been googling for an hour but can't seem to figure this out
loop in a scheduler runnable, check every player, run stuff
oh yeah so i just watched a video about tasks and schedules, but i wasntsure if that was the solution to myproblem
CraftTravelAgent doesn't exist, as well as TravelAgent.DEFAULT. At least it's not showing up in the docs nor in the ide
its not in the api
so should i just run a task every tick to detect the player value? or is there an event or something i could use
idk
A b c, easy as N M S
Is it still possible to use?
There is a toggle sprint event
I never understood this either. If their goal is to improve performance so the server doesn't have to use memory to keep track of scoreboards, they're defeating that very same goal by manually keeping track of which player is assigned to which team in their own scoreboard they're sending their own packets for
oh thats just one of many things tho

without recompiling spigot jar
like if a player has a tag of "Piglin" i want golden stuff to be stronger for them
stuff like that
i dont see an event for detecting player nbt tho
Would it work if I just copy paste it from the spigot sources?
If you want swords to be stronger or something, yes
fork is edit code ?
if that's not sarcastic question which I didn't get it, its practically yes. Its your repository where you can edit the source code of the software
where can I find the SynchedEntityData class? it throws it out to me as an exception, and I do not see it in the files some time.
Caused by: java.lang.IllegalArgumentException: Duplicate id value for 15! at net.minecraft.network.syncher.SynchedEntityData.define(SynchedEntityData.java:90) ~[app:?]```
it wasnt sarcastic am just new to this xD
is it possible to fork a plugin that's not open source ?
No
yesn't
What you trying to do?
oh that sounds interesting
i wanna do it with strike practice plugin
i want to fix some things
which is 1 reason why am learning to code plugins
its morally ok to edit software to fix bugs
Fix that exception :/
Caused by: java.lang.IllegalArgumentException: Duplicate id value for 15!
at net.minecraft.network.syncher.SynchedEntityData.define(SynchedEntityData.java:90) ~[app:?]
at pl.tuso.xentitydev.entities.type.EntityDev.initDatawatcher(EntityDev.java:98) ~[xEntityDev-2021-11-18 22.46.jar:?]
at net.minecraft.world.entity.Entity.<init>(Entity.java:508) ~[patched_1.17.1.jar:git-Paper-386]
at net.minecraft.world.entity.LivingEntity.<init>(LivingEntity.java:281) ~[app:?]
at net.minecraft.world.entity.Mob.<init>(Mob.java:131) ~[app:?]
at net.minecraft.world.entity.PathfinderMob.<init>(PathfinderMob.java:19) ~[app:?]
at pl.tuso.xentitydev.entities.type.EntityDev.<init>(EntityDev.java:64) ~[xEntityDev-2021-11-18 22.46.jar:?]
at pl.tuso.xentitydev.entities.Snail.<init>(Snail.java:22) ~[xEntityDev-2021-11-18 22.46.jar:?]
at pl.tuso.xentitydev.events.DevCommand.onCommand(DevCommand.java:25) ~[xEntityDev-2021-11-18 22.46.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.17.1.jar:git-Paper-386]
... 21 more```I get it at
```java
@Override
protected void initDatawatcher() {
super.initDatawatcher();
this.Y.register(dA, (byte)0);
this.Y.register(dB, vA);
this.Y.register(dC, vB);
this.Y.register(dD, vC);
this.Y.register(dE, vD);
this.Y.register(dF, vE);
this.Y.register(dG, vF);
}```
tell that to the people who make a tos saying you can’t decompile
It's not that easy. There are a lot of internal references
why tho
Before, I didn't have it, and I didn't change anything in the code, until one time I started throwing this exception out.
Because their code is clearly top quality and very lucrative to steal
did you just reply urself ?
it sometimes illegal to decompile software, especially rerelease them on shelves with patches
decompiling works well ?
yep
well spigot and paper are kinda doing naughty stuff behind the buildtools and paperclip
someone once told me its not very good
when plugin is too big with multiple classes
still it modifies bytecode of .class files
but that's legal
since the server is downloaded from mojang servers
while patches are going out straight from repos
Yep
this thing exists only due to DMCA of craftbukkit drama
it doesnt decompile 100% error free
Not really
you need to correct some places to make it work
Re-hosting the minecraft server has never been allowed afaik
still easier to fix than recreate plugin ?
depends on the plugin
Also depends if they tried to obfuscate it
fernflower
if you want something simple
use jd-gui
fernflower is included inside intellij idea
ohh
you can just plop the jar file inside your project libraries
and it'll allow you to decompile .class files that are in that jar file
well
time to fix the strikepractice
i wont republish it
also
thoughts on this ? https://elb1to.me/frost/
Frost - The Best Practice Plugin
it costs 100+$
It costs what now
how he have been able to modify tab background color
could be client ?
yeah
lol its elb1to
is it ide specific?
Intellij IDEA IDE has integration with Fernflower decompiler
JD-GUI is a standalone Java GUI application
Bytecode viewer is another option
Fernflower is baked into IDEA tho, seeing as JB were the ones who made it.
There is a mirror that separates the two tho.
yea
Fernflower is a very good decompiler tho.
I have it in my crows :)
also
use crow
it's cool
I made it
shameless plug
what is crows
glad you asked :) https://github.com/MaowImpl/crow
I don't quite understand the process. Do I need to decompile it to be able to import keeping internal references?
that was not for you
😅
Anyway I basically made this to make it easier to run jars bc:
- Some programs on Gradle don't use the
applicationplugin that automatically generates abatfile. - Even then, you'd still have to add the program to your PATH, and that can get messy.
So ye mainly a Windows thing.
That’s neat
how can I find out the minecraft server version?
I believe Bukkit has a method for it.
through another jar btw
...you mean one running independently of the Minecraft JVM?
yes he does
yea
without doing that Choco
? then how do you expect to get it? lol
with some magic code
you could send the version from a plugin on the server through a socket/RMI to your external jar
Going to wish it into existence?
craftbukkit package is still named with the version right?
Yes
so use that ig then
if you don't wanna use a plugin on the server, have fun figuring out process memory 👋
huh
or ye you can also use the craftbukkit package
Is it located in org/bukkit/craftbukkit?
I think so
or the manifest
which literally has the version in it
yea
It's practically a text file
more effort
Use reflection to check for the existence of various classes to single in on a version
Best method
isnt there like uh Bukkit.getVersion
yeah
that doesn't return just Minecraft version tho afaik
but it contains Minecraft version
you shouldnt ever need to know the mc version
everyone wants to make plugins into mods 😦
through another jar btw
the whole point of plugins is to not need updating every MC version
NMS modules
Doesn't want to use a plugin
maybe if the API were better this would be possible
😮
is this even something special ?
so uh improve the API?
doesn't really sound like it tbh
fix it felix
I can imagine it's literally just a kill entities thing lmao
the best irony is that server owners complain to developers each release to update their plugins
why dont they complain to authors to code their plugins to not need updates
or is that too big brain
Developers don’t want to wait for PRs to be accepted
no that's putting the cart before the horse
wait are you not able to use a hashmap in FileSystems#newFileSystem?
I think you are
also why do you need a ZipFileSystem for your jar reading?
it's generally slower
except when replacing shit ig
cuz without a ZipFS then replacing requires you to rewrite every jar entry through java.util.jar (which, until Java 9 or so, used native methods bc of zlib)
so, do HEX colours just not work in components?
odd
TextComponent
bungee
im using ChatColor.of(Color)
Java.awt.color
i think its java.awt.Color actually,
post your full code
do keep in mind im new to TextComponents)
its really just on the Hover part that i can notice it
b l u r p l e
because your concating legacy text into the hover
oh shit
you need to use TextComponent.fromLegacyText to convert it
ahhhh
or build it with components rather than strings
and have List<BaseComponent> roles instead
yes
coolio
love blurple
blurple.
Is there any way to control where a Nether Portal spawns? (i know there is a PortalCreateEvent, but it only gives you List<BlockState>, meaning you cant change the block position)
How do I get the ID (-1, 0, 1, -999) of the Worlds Dimension?
getId() is deprecated, but whats the alternative/new way to get it?
I have a plugin that when blocks are broken or placed they give xp, how can i make it so if a block was placed, that block when broken wont give xp?
please ping me if you know
why do you need it?
so people can't farm the same block over and over
Presumably md is responding to the post above
oh
You would need to attach some metadata to it
Though with PDC you can only do this for tile entities
And most blocks that drop xp are not tile entities
When a block is broken, store its x/y/z in teh chunk pdc. If the location already exists you don;t give xp
Chunks have PDC? I did not know that
what does pdc stand for
?pdc
ah ok
cant they just place it somewhere else outside the chunk and get xp?
each chunk has its own pdc
when a block is broken, you store that x/y/z in the relevant pdc
you are markign locations that have had a block broken
you can do the same for block place
So when a block is placed you add its x/y/z to teh pdc and it will not give xp when broken
alr ill see what i can do ty
hello. i need to get who placed the items in the brewing stand
basically i want to give him xp
I have never touched maven before how the hell do I shade?
Google your question before asking it:
https://www.google.com/
InventoryClickEvent should be the way to go
i dont think that breaks anything
just get which slot was "clicked", and if theres now an item in it.
Save last player who put something in, maybe using the brewing stands position. Maybe HashMap<Position, Player>.
And in the brewevent get position and look up last player
should work, or not?
Hex: #7289DA
RGB: 114, 137, 218
Thats what it looks like
its light blue basically
What causes this error?
[02:13:10 ERROR]: The embedded resource 'config.yml' cannot be found in plugins..-1.0.jar initializing ..v1.0 (Is it up to date?)
I run saveDefaultConfig(); in onLoad
Hey uh im getting Plugin 'org.apache.maven.plugins:maven-shade-plugin:3.2.0' not found (Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.1:shade (default-cli) on project ww: Failed to create shaded artifact, project main artifact does not exist.
)
so i dont get why it doesnt exist
ok so google says i need a config.yml in my plugins jar
Where does it have to be? in source.main.resources ? or at the topmost level? or at the level my code files are at?
Same level as plugin.yml
I'm currently in the process of making a MC server in C#. When implementing the final bits of the MOTD, I've found that the Chat object supports fonts. The fonts it supports is the uniform (unicode font), alt (Enchanting table) and default. Now, the discovery I've found is that the font works on the MOTD. Since I'm currently in the process of making a legacy string parser for the Chat object, I was wondering what symbol should be used to set the font? Since color/formatting codes come after §, I don't want to use any of those. §# is used to show that a Hex code is coming up (even though it's not natively supported by the client). I was thinking that §@1-9 should be used to set the font. Thoughts?
it will convert into a font later
and it still depends on the resource pack ngl, some servers use font to make custom emoji, faces, etc...
Through using a font property, I was able to set the text to the enchanting table font
(1.16+ only obviously)
does WorldSaveEvent get called on a normal server stop?
or does the plugin already get disabled before that?
Test it with a sysout
cant rn, hoped maybe someone just knows
How can i run something every second?
BukkitScheduler only accepts ticks, which i assume rely on server performance
so if my server is 10 tps instead of 20 tps, it will only run once every 2 seconds, which is not what i want
is there a spigot way?
or do i need to use ScheduledExecutorService / Timer
If the player DeltaXZ is greater than 0 does that mean they are going at a suspicious speed?
How do I send a string to a players actionbar?
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, ...) is deprecated
no its not
@ember estuary yeah executor service would work, iirc so would an async task.. but either way you need to sync back up
oh, i thought i was looking at the spigot docs, but it were the paper docs. the "player.spigot" irritated me. my bad
nah, no need to sync, i wanna measure realtime
ill use executer service then, thank you
D is just a double float right?
Yes
am I doing my math right
if someone has speed 2 and is sprinting they would be going 0.21 right?
what do you mean not blocks?
"Speed of movement in some unknown metric. The mob's maximum speed in blocks/second is a bit over 43 times this value"
then im not sure what im doing wrong
I'm not sure if this is the proper way to use EventHandlers, but I'm trying to use an event listener in another class to do some logic.
So I have this listener:
public class PlayerPortalEnterEvent implements Listener {
@EventHandler
public boolean onPlayerPortalEnter(EntityPortalEnterEvent event, Portal portal) {
Location[] portalBlocks = portal.getPortalBlocks();
Location portalLowerLocation = portalBlocks[0];
Location portalUpperLocation = portalBlocks[1];
if (portalLowerLocation == event.getLocation() || portalUpperLocation == event.getLocation()) {
return true;
} else {
return false;
}
}
}
And in another class I want to be able to do something like this:
if (PlayerPortalEnterEvent.onPlayerPortalEnter(portal) = true) {
//do stuff
} else {
continue;
}
Is this possible?
Nope, it is called internally. just add that logic into your event handler
Make them return void
Alright
And if I need to use that logic in another class (when a command is ran)
Should I do something differently?
You should only have the event as the parameter as well
Once again that method is called internally. In most cases, you should not be calling the command method
Could I potentially make a custom event and then listen to that within a command?
Custom events are possible. But I think you are having an XY problem(https://xyproblem.info/). What are you trying to accomplish
Also don't use == to compare objects use .equals()
and why is there a continue; You should maybe spend some more time learning java rather than directly jumping into spigot
That logic is generally just psuedo code
To get my intention across
Yeah true on the XY problem, let me back up.
I am creating a teleportation plugin, but it uses small portals (using end gateway blocks) to teleport the player.
When the player runs for instance the /tp command it creates a portal which lasts for let's say 10 seconds
What I need to do is when the player enters the portal, run my teleportation logic (already have it)
I can't necessarily put my teleportation logic into the EventHandler because the destination is handled by the /tp command
So my plan was to create the portal within the command, and before the portal is deleted (in 10 seconds) listen to the event and teleport the player if need be (if the player enters the portal)
Store the location in a HashMap possibly, or create an object for the portal that stores all the data needed.
Yeah I guess that makes the most sense
Is it possible to cache multiple places in a hashmap using a class?
For example, to cache a player I pull information from a class
However there can only be one player per hashmap, I would like to do the same with the houses, but how do I put several houses for one player?
Use a mutlimap
Or create a class that holds a list of locations
And then map to that
Map<K, List<V>>
Dedicated multimap classes are for cowards
People too afraid to use IdentityHashMapMap<Map<Player, Collection<UUID>>, Vector<Map<PriorityQueue<Integer>, BiFunction<Player, String, List<Map<? extends ? extends Object, TreeSet<Long>>>>>>>
FastAsyncDeluxeJoinMessagesUUID
Why not just use a Location though
Also I'd imagine you want a Map<UUID, Map<String, LBHome>>
So that you can get homes by name per player
yes
How would this work?
You're storing x, y, z, pitch, yaw (but not world for some reason?)
Just store a Location instead
It already stores all those things
(Table<UUID, String, LBHome>)
What library is that from
Guava
I don't get why you keep sending screenshots of code instead of code
And that's not enough code for us to know what you're talking about
oh shit
private static final Map<UUID, Map<String, LBHomes>> homesCache = new HashMap<>();
this is my cached hashmap
How do I get houses by name?
You'd need to get it by UUID and name
cache.get(uuid, name) ?
