Skip to content

Instantly share code, notes, and snippets.

case DENY:
switch (action) {
// Modified other slots
case MOVE_TO_OTHER_INVENTORY:
case HOTBAR_MOVE_AND_READD:
case HOTBAR_SWAP:
case COLLECT_TO_CURSOR:
case PLACE_DRAG_SINGLE:
case PLACE_DRAG_EVEN:
case UNKNOWN:
public void purgePowerlessUsers() {
mcMMO.p.getLogger().info("Purging powerless users...");
try {
// This does the deleting and returns the usernames of who we deleted
ResultSet result = SQLStatements.getInstance().getStatement("powerlessPurge").executeQuery();
int purgeCount = 0;
while (result.next()) {
Misc.profileCleanup(result.getString(0));
purgeCount++;
}
@riking
riking / Particle Descriptions
Last active July 22, 2018 20:22
Remember to include ANIMATIONS in the Appearance field! Example pictures (do not demonstrate pitfalls): http://imgur.com/a/73nwQ#20
Parameters:
Count: This is literal. The count parameter specifies how many particles to spawn at once
with these exact same parameters.
Spread: The starting position of each particle is a normal number with mean of the Location
and standard deviation of the Spread, e.g. (Norm(Loc.X, Spread.X), Norm(Loc.Y,
Spread.Y), Norm(Loc.Z, Spread.Z)). This means that 68% of the particles will be
within the bounding box of +/- 1*Spread, 95% will be within +/- 2*Spread, and 99.7%
will be within +/- 3*Spread for each coordinate.
Speed: The effect of this is determined by each particle.
@riking
riking / AC_RunActiveContent.js
Created June 17, 2013 00:16
Found this on a CD mailed out by a college
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
/**
* ....
* <p>
* This event is the first in the login process lifecycle. The lifecycle goes
* as follows:
* <ol>
* <li>Username verification with Mojang (unless in offline/insecure mode)</li>
* <li>AsyncPlayerPreLoginEvent<br>
* <b>Only if necessary:</b>
* <ol>
public void logColor(String s) {
ConsoleCommandSender c = Bukkit.getConsoleSender();
if (c != null) {
c.sendMessage(s);
} else {
getLogger().info(ChatColor.stripColor(s));
}
}
@@ -15,8 +15,10 @@ public class CraftCreature extends CraftLivingEntity implements Creature {
EntityCreature entity = getHandle();
if (target == null) {
entity.target = null;
+ entity.setGoalTarget(null);
} else if (target instanceof CraftLivingEntity) {
entity.target = ((CraftLivingEntity) target).getHandle();
+ entity.setGoalTarget(((CraftLivingEntity) target).getHandle());
entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F, true, false, false, true);
}
/////////////////////////////
// An API method ///////////
/////////////////////////////
/**
* Reads the player's rank in each Skill from the database and runs the
* callback on the main thread.
*/
public void readRankAsync(String playerName, Function<Map<SkillType, Integer>, Void> callback);
case RANK_BOARD:
Bukkit.getScheduler().runTaskAsynchronously(mcMMO.p, new ReadRankAsyncTask(targetPlayer == null ? playerName : targetPlayer, new Function<Map<String, Integer>, Void>() {
@Override
public Void apply(Map<String, Integer> rankData) {
Integer rank;
Player bPlayer = Bukkit.getPlayerExact(playerName);
if (bPlayer == null) return null;
for (SkillType skill : SkillType.nonChildSkills()) {
package me.riking.templateworlds.api;
import java.util.Collection;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
public interface ApiMain {
/**