« first day (1430 days earlier)      last day (1809 days later) » 

Anonymous
6:07 AM
0
Q: How to dynamically change the period of a repeating Java Runnable?

MALONFirst off, this is Minecraft/Bukkit related, but I believe my problem is not Bukkit specific, just overlooking something small I think (I hope). At the very bottom of my code is a randomDelay and randomPeriod. The run() function runs repeatedly at a given interval based on these two variables. I...

 
Anonymous
^ @Unihedron good question
 
7:14 AM
 
Sam
7:47 AM
Morning.
 
 
1 hour later…
8:56 AM
Morning!!
 
9:18 AM
@Joiner good avatar from the guy
 
 
1 hour later…
Anonymous
10:36 AM
@Unihedron my avatar ?
 
@Joiner no, OP
 
Anonymous
i saw
 
Anonymous
lol
 
in Tavern on the Meta on Meta Stack Exchange Chat, 1 min ago, by Infinite Recursion
@SilentKiller @Uni wrote "Let's recurse! Oh yeah!"
 
Anonymous
10:37 AM
how can i set a random integer without repeating
= random.nextInt(201) + 20;
two times
 
you can't. the simple way out is not to.
 
Anonymous
maybe with a method ?
 
I only upvoted your answer because it was there first. It's actually a mediocre solution to read-write to that integer field every tick.
 
Anonymous
1
A: How to dynamically change the period of a repeating Java Runnable?

JoinerSet the period to every tick. Task task = new Task(); task.runTaskTimer(Plugin, 1L, 1L); Then use an index and reset it every time the random delay is reached. public class Task extends BukkitRunnable() { private Random random = new Random(); private int index; public Task() { ...

 
Anonymous
look at the new code
 
Anonymous
10:43 AM
@Unihedron are you dealing with your parrot ?
 
Not really.
@Joiner You're still writing to index every tick though.
 
Anonymous
i know
 
Anonymous
it was an improvement in code "legibility"
 
Welcome to Java, where JIT optimizes everything. Your task as a programmer is to use the best algorithm.
 
Anonymous
tank iu but im a newbye nd i cant down eclps
 
Anonymous
10:50 AM
u sry 4 my nglsh
 
Anonymous
1:06 PM
@Unihedron what is the event to know when a player defend itself with sword ?
 
Anonymous
and when no longer defend
 
@Joiner you mean when he "attempts" to block (riht klik) or when he blocks successfully?
 
Anonymous
attempts
 
playerinteractevent ignoreCancelled=true
write checks in there
 
Anonymous
i know
 
Anonymous
1:08 PM
but
 
Anonymous
we can't use this event to know when he no longer blocks
 
Anonymous
that is
 
Anonymous
when he no longer right-clicks
 
so really, you want to know when a player stops defending himself with the sword
 
Anonymous
yes
 
Anonymous
1:12 PM
and, if that event works also with starting defending
 
Anonymous
ù.ù
 
looking it up :)
I'm not a wizard...
You can listen to this while you're waiting if you want
 
Anonymous
i'm not a child
 
You sound so much like rene. :)
 
Anonymous
however, 2 seconds of googling
 
Anonymous
 
Anonymous
Player.isBlocking()
 
it's been there since forever, however it's not an event..
 
Anonymous
you can use a task
 
well that's stupid. mcmmo doesn't do that in their code.
 
Anonymous
what does it do
 
1:27 PM
it just... starts repeating checks on whether player is blocking when he starts to block, and when he stops blocking stops the checks and score synchronized invocation
 
Anonymous
this is a task
 
well yeah.
 
Ugh, I hate forums. Four posts down the line and it turns to anti-mineplex discussion.
 
Anonymous
what ?
 
1:35 PM
This is why I like SO more than forums:
^ ( click to expand )
 
Anonymous
stack overflow is good, the problem is they should remove downvotes
 
Anonymous
if you find a good post, upvote, else, leave a comment
 
Anonymous
stop
 
@Joiner make a post on meta so users can vote on it
 
Anonymous
hahahah
 
Anonymous
1:39 PM
post:
 
Anonymous
remove downvotes, they are useless
 
Anonymous
result:
 
Anonymous
votes: -100
 
Anonymous
this is crazy
 
The problem is with "they are useless".
look:
^ It doesn't get downvotes because I didn't write "They are useless" or any unhelpful statements in it.
This post shows accurately what I mean by "so users can vote on it".
 
Anonymous
1:55 PM
what reason should i provide
 
many reasons
you said, it discourages users from learning, it keeps a potential for misuse, serial downvoting
 
2:08 PM
https://mojang.com/2014/09/yes-were-being-bought-by-microsoft/
http://news.xbox.com/2014/09/games-minecraft-to-join-microsoft
 
Anonymous
microsoft bought mojang!
 
If they're not making the game open-sourced, I'd stop developing it and choose another game to mod.
 
Anonymous
i think this is a good thing
 
Anonymous
i think microsoft will update minecraft better than mojang
 
2:47 PM
@Joiner Why do you think they ditched the Skype API shortly after Microsoft acquired it?
 
Anonymous
3:04 PM
i hope*
 
4:04 PM
Evening!
 
Evening!
 
Sam
Evening!
 
@Joiner What the actual? You serious?
 
Anonymous
if you want more bukkit questions
 
4:11 PM
OK, note to self: get moderator diamond on gamedev.SE so I can ban-hammer those questions
 
Anonymous
some people post them here
 
Anonymous
@Unihedron what ?
 
I'll look at them tomorrow. It's midnight and I can't code anymore.
 
Anonymous
current time is 18:12
 
Anonymous
midnight ???
 
4:12 PM
@Joiner It's midnight where @Unihedron lives.
 
Anonymous
ah
 
Anonymous
@Unihedron what did you mean
 
@Joiner do you not know what a diamond is?
 
Anonymous
it is a cat
 
4:18 PM
... I'll be right back.
 
Anonymous
2
A: copy file to clipboard and paste it somewhere else

JoinerYou could use directly My.Computer.FileSystem.CopyFile. Dim source As String = lvFotos.SelectedItems(0).Tag Dim destination As String = My.Computer.FileSystem.SpecialDirectories.Desktop & from.Substring(from.LastIndexOf("\")) My.Computer.FileSystem.CopyFile(source, destination)

 
Anonymous
thank you
 
Anonymous
for the upvote you are going to do :)
 
I don't do VB.
 
Anonymous
but you do upvotes :)
 
4:31 PM
I don't do voting irregularities.
The upvote hover text says: "This answer is useful". It wasn't useful to me.
 
Anonymous
ok, it was only a question
 
Anonymous
because i got 2 upvotes, so i thought it was a good answer
 
What does it do though?
It looks like... code
 
Anonymous
because it is code
 
Anonymous
but.. code wrote by joiner, this is the difference!
 
4:34 PM
Continue?
 
Anonymous
?
 
4 mins ago, by Unihedron
What does it do though?
 
Anonymous
it suggests a new approach
 
..... What does the code do?
 
Anonymous
it copies the file
 
Anonymous
4:46 PM
instead of pasting its content in the clipboard
 
5:06 PM
Hey @Joiner, I have to go sleep, it's late. Catch you around some time later. :)
 
Anonymous
when you'll wake up, you'll have to go to school
 
The teachers can't keep up anyway.
 
Anonymous
it's 19:07, so lot of hours remains to me :P
 
They're still teaching loops in classes..
 
 
3 hours later…
7:50 PM
Hi everyone
How you can do a matrix in array
because something like array = [5][3] doesn't works
 
Let me see, you drop in a random room, paste some vague code and expected us to know the answer? We're good but not that good....
3
 
What are you even.
If it's C++, I believe the syntax goes array[x][y];
And you can have more than 2 i suppose
 
8:06 PM
Your guess is as good as mine...
 
 
3 hours later…
11:17 PM
 

« first day (1430 days earlier)      last day (1809 days later) »