Skip to content

Instantly share code, notes, and snippets.

View codebucketdev's full-sized avatar

Codebucket codebucketdev

View GitHub Profile
@codebucketdev
codebucketdev / gist:7144068
Last active December 26, 2015 11:29
With this snippet, you can send to all Operators a Information about a task...
public void alertOperators(org.bukkit.command.CommandSender sender, String alert)
{
for(Player player : Bukkit.getOnlinePlayers())
{
if(player.isOp())
{
if(!sender.getName().equals(player.getName()))
{
player.sendMessage("§7§o["+sender.getName()+": "+alert+"]");
}
@codebucketdev
codebucketdev / gist:7711362
Created November 29, 2013 20:17
With this snippet, you can pull a player to a location...
private void pullPlayer(Player player, Location location)
{
Location playerLoc = player.getLocation();
playerLoc.setY(playerLoc.getY() + 0.5D);
player.teleport(playerLoc);
double g = -0.08D;
double d = location.distance(playerLoc);
double t = d;
@codebucketdev
codebucketdev / gist:8558614
Created January 22, 2014 13:22
Database.java class of my MySQL System
package de.codebucket.mysql;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Database
{
@codebucketdev
codebucketdev / gist:8558628
Created January 22, 2014 13:23
Operators.java class of my MySQL System
package de.codebucket.mysql;
import java.util.HashMap;
import java.util.Map;
public class Operators
{
public enum DataTypes
{
Text(1), Char(2), Int(3), Decimal(4), Float(5), Double(6), Boolean(7), Date(8), Time(9);
@codebucketdev
codebucketdev / gist:8558646
Created January 22, 2014 13:25
Table.java class of my MySQL System
package de.codebucket.mysql;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import de.codebucket.mysql.Operators.DataTypes;
@codebucketdev
codebucketdev / gist:8558660
Created January 22, 2014 13:25
Exampleclass for my MySQL System
package de.codebucket.mysql;
import java.sql.SQLException;
import java.util.List;
import java.util.Random;
import de.codebucket.mysql.Operators.DataTypes;
public class SqlTest
{
package de.zh32.slp;
import com.google.gson.Gson;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
@codebucketdev
codebucketdev / gist:10561079
Created April 12, 2014 22:59
Usefull Enchanting snippet
public enum EnchantmentType
{
TOOL(Arrays.asList(32, 33, 34, 35)),
ARMOR(Arrays.asList(0, 1, 2, 3, 4, 7, 34)),
SWORD(Arrays.asList(16, 17, 18, 19, 20, 34)),
ARROW(Arrays.asList(48, 49, 50, 51, 34));
private List<Integer> enchantments;
EnchantmentType(List<Integer> enchantments)
@codebucketdev
codebucketdev / PingTest.java
Created July 5, 2014 11:20
With this snippet you can ping a IP Address or Hostname in Java on Windows.
private InetAddress inet;
private long start;
private long end;
public PingTest(InetAddress inet)
{
this.inet = inet;
this.start = System.currentTimeMillis();
this.end = (this.start -1);
}
@codebucketdev
codebucketdev / MojangRepository.java
Created July 5, 2014 13:02
With this MojangRepository you can get a UUID from a Username and other way.
package de.codebucket.accounttool;
import java.util.UUID;
import de.codebucket.utils.NameFetcher;
import de.codebucket.utils.UUIDFetcher;
public class MojangRepository
{
public static String getUsername(UUID uuid) throws Exception