This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INPUT | |
final Map<ItemStack, Double> myItemsWithWeight; // Initialized somewhere before that | |
// Data | |
final List<ItemStack> myItems = new ArrayList<>(myItemsWithWeight.size()); | |
final double[] risingWeights = new double[myItemsWithWeight.size()]; | |
// Compute total weight | |
double total = 0; | |
for (final double d : myItemsWithWeight.values()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java 6 | |
SomeStream stream | |
try { | |
stream = new SomeStream(someArg); | |
// Stuff | |
} catch (SomeStreamExceptions e) { | |
// Stuff | |
} final { | |
try { | |
stream.close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias sb_start="sudo start starbound" | |
alias sb_stop="sudo stop starbound" | |
alias sb_restart="sb_stop;sb_start" | |
alias sb_update="sudo /home/ribesg/sb_update" | |
alias sb_online="netstat -nt | grep -c 21025" | |
alias sb_status="sudo status starbound" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################################### | |
## Config file for NPlayer plugin ## | |
## If you don't understand something, please ask on dev.bukkit.org ## | |
## Ribesg ## | |
##################################################################### | |
# Maximum login attempts before punishment. Possible values: Positive integers | |
# Default : 3 | |
maximumLoginAttempts: 1 | |
# How do we punish people after too many attempts? Possible values: 0, 1, 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################################### | |
## Config file for NTalk plugin ## | |
## If you don't understand something, please ask on dev.bukkit.org ## | |
## Ribesg ## | |
##################################################################### | |
# The template used to parse chat messages | |
# Default : &f<[prefix][name][suffix]&f> [message] | |
template: "[prefix][name][suffix] &f: [message]" | |
# The template used to parse private messages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
/** @author dumptruckman, Ribesg */ | |
public class ArgumentParser { | |
/** | |
* Transform a Bukkit-provided args array, considering quotes in the original String. | |
* Example: | |
* - Input = { a | 'b | c | d' | "e | f | g" | h"i | j" | "k | l'm | n" | 'o | p | q } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Parses an original args array provided to a CommandExecutor to support quotes. | |
* If the parameter array is malformed, then this method returns the parameter array as-is. | |
* | |
* @param args The original args array. Ex: ['A', '"B', 'C', 'D"', 'E'] | |
* | |
* @return The resulting args array, if valid. Ex: ['A', 'B C D', 'E'] | |
*/ | |
public static String[] parseArgumentsWithQuotes(String[] args) { | |
final List<String> resultList = new ArrayList<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Parses an original args array provided to a CommandExecutor to support quotes. | |
* If the parameter array is malformed, then this method returns the parameter array as-is. | |
* | |
* @param args The original args array. Ex: ['A', '"B', 'C', 'D"', 'E'] | |
* | |
* @return The resulting args array, if valid. Ex: ['A', 'B C D', 'E'] | |
*/ | |
public static String[] parseArgumentsWithQuotes(String[] args) { | |
final List<String> resultList = new ArrayList<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestClass { | |
public void method() { | |
// 1 | |
} | |
public void someOtherMethod() { | |
new Runnable() { | |
@Override | |
public void run() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// !gstats | |
private class GlobalStats { | |
public String serversAmount; | |
public String serversDiff; | |
public String serversMax; | |
public String serversMin; | |
public String serversAvg; | |
public String playersAmount; |