Skip to content

Instantly share code, notes, and snippets.

/**
* Get the inventory in this view that contains the given slot.
* @param rawSlot a raw slot number
* @return the inventory with that slot number, or null if not applicable
*/
public final Inventory getInventoryWithSlot(int rawSlot) {
int numInTop = getTopInventory().getSize();
if (rawSlot < 0) {
package org.bukkit.potion.newpotion;
import org.bukkit.inventory.ItemStack;
public interface NewPotionBrewer {
/**
* Complete a brewing action on the given potion. This method will modify
* the ItemStack given in its potion argument, and return true when
* finished. If the brewing fails for any reason, such as the potion item
* not actually being a potion or the ingredient not being valid, false
package com.gmail.nossr50.config;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/ja
index 5e542b8..ad7d144 100644
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
@@ -34,6 +34,10 @@ public abstract class InventoryView {
*/
TICKS_FOR_CURRENT_FUEL(2, InventoryType.FURNACE),
/**
+ * In an anvil inventory, the repair cost experience level value.
+ */
diff --git a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java
index 9a03c3a..1f1f156 100644
--- a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java
+++ b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java
@@ -13,9 +13,12 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
diff --git a/src/main/java/com/gmail/nossr50/util/player/UserManager.java b/src/main/java/com/gmail/nossr50/util/player/UserManager.java
index c6b691e..b468597 100644
--- a/src/main/java/com/gmail/nossr50/util/player/UserManager.java
+++ b/src/main/java/com/gmail/nossr50/util/player/UserManager.java
@@ -84,7 +84,7 @@ public final class UserManager {
playerName = matches.get(0).getName();
}
- return players.get(playerName);
+ return logNull(playerName);
@riking
riking / Faction Scoreboard.java
Last active December 20, 2015 11:49
Pseudocode for Faction scoreboards
This is pseudocode.
Faction {
private transient Scoreboard scoreboard = makenewscoreboard()
}
updateScoreboards() {
Set<Faction> toUpdate;
for (Player p : onlinePlayers) {
UPlayer up = UPlayer.get(p);
from util import hook, http
fml_cache = []
def refresh_cache():
""" gets a page of random FMLs and puts them into a dictionary """
soup = http.get_soup('http://www.fmylife.com/random/')
for e in soup.find_all('div', {'class': 'post article'}):
package test;
import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCreativeEvent;
@riking
riking / gist:6226100
Created August 13, 2013 21:53
Bukkit-only entity copier
{
Entity[] sourceEntities = sourceChunk.getEntities();
for (Entity oent : sourceEntities) {
Entity nent;
if (oent instanceof Arrow) {
nent = world.spawnArrow(oent.getLocation(), oent.getVelocity(), (float) oent.getVelocity().length(), 0F);
} else if (oent instanceof FallingBlock) {
FallingBlock o = (FallingBlock) oent;
nent = world.spawnFallingBlock(oent.getLocation(), o.getBlockId(), o.getBlockData());