Skip to content

Instantly share code, notes, and snippets.

@EdGruberman
EdGruberman / gist:949394
Created April 30, 2011 04:11
break an if
if (test1) {
if (!test2) break;
// do stuff here if not false.
}
@EdGruberman
EdGruberman / gist:972582
Created May 14, 2011 20:10
MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 19.1-b02 (Sun Microsystems Inc.)
Name: edgruberman/bukkit/simplegroups/
Specification-Title: SimpleGroups
Specification-Version: 1.0
Specification-Vendor: EdGruberman ([email protected])
Implementation-Title: edgruberman.bukkit.simplegroups
Implementation-Version: 0a14
@EdGruberman
EdGruberman / gist:993526
Created May 26, 2011 17:07
CraftBukkit 812 Compilation Error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project craftbukkit: Compilation failure: Compilation failure:
[ERROR] D:\Documents\Development\Bukkit\CraftBukkit\src\main\java\org\bukkit\craftbukkit\CraftServer.java:[369,122] cannot find symbol
[ERROR] symbol : method getId()
[ERROR] location: class org.bukkit.World.Environment
[ERROR]
[ERROR] D:\Documents\Development\Bukkit\CraftBukkit\src\main\java\org\bukkit\craftbukkit\CraftServer.java:[372,65] cannot find symbol
[ERROR] symbol : method getId()
[ERROR] location: class org.bukkit.World.Environment
[ERROR]
[ERROR] D:\Documents\Development\Bukkit\CraftBukkit\src\main\java\net\minecraft\server\MinecraftServer.java:[171,51] cannot find symbol
/**
* Returns player only if it is a full and case insensitive name match.
*
* @param name Name of player.
* @return Player that matches name.
*/
static Player getExactPlayer(String name) {
Player player = Bukkit.getServer().getPlayer(name);
if (player == null) return null;
@EdGruberman
EdGruberman / gist:1065810
Created July 5, 2011 20:13
getFrom/getTo
@Override
public void onPlayerMove(PlayerMoveEvent event) {
if (event.isCancelled()) return;
Block from = event.getFrom().getBlock();
Block to = event.getTo().getBlock();
if (from.equals(to)) return;
this.main.checkCrossings(event.getPlayer(), from, to);
}
@EdGruberman
EdGruberman / gist:1172573
Created August 26, 2011 02:47
Border Portal Test
2011-08-25 19:03:18 [FINEST] º0[SimpleBorder] BDillow entered a portal at [Worlds/World1] x:1813 y:56 z:2168 | Nether match is x:227 y:56 z:271 ( 1813.0092973709511,56.0,2168.623959345796 | 226.6261621713689,56.0,271.0779949182245 )
2011-08-25 19:03:19 [FINEST] º0[SimpleBorder] Attempting to locate an existing portal for BDillow near [Worlds/World1_nether] x:226 y:56 z:271 | Overworld match is x:1813 y:56 z:2169 ( 226.6261621713689,56.0,271.0779949182245 | 1813.0092973709511,56.0,2168.623959345796 )
2011-08-25 19:03:19 [FINEST] º0[SimpleBorder] Existing portal found for BDillow at null
2011-08-25 19:03:19 [FINEST] º0[SimpleBorder] Requesting portal creation for BDillow at [Worlds/World1_nether] x:226 y:56 z:271 | Overworld match is x:1813 y:56 z:2169 ( 226.6261621713689,56.0,271.0779949182245 | 1813.0092973709511,56.0,2168.623959345796 )
2011-08-25 19:03:19 [FINEST] º0[SimpleBorder] Identified newly created portal for BDillow at [Worlds/World1_nether] x:214 y:21 z:271 | Overworld match is x:1716 y:21 z:2168 (
@EdGruberman
EdGruberman / MessageManager.yml
Created September 8, 2011 21:45
MessageManager.yml Full Debug Logging (/plugins/<plugin>/MessageManager.yml)
send:
PLAYER:
level: ALL
SERVER:
level: ALL
WORLD:
level: ALL
LOG:
level: ALL
List<String> stuff = (List<String>) this.getConfig().getList("nodeName");
for (String entry : stuff)
System.out.println(entry);
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
in an EntityListener:
@Override
public void onEntityCombust(final EntityCombustEvent event) {
if (event.isCancelled() || !(event.getEntity() instanceof Player)) return;
DamageReport.recordCombuster(event);
}
in DamageReport:
static void recordCombuster(final EntityCombustEvent event) {
@EdGruberman
EdGruberman / gist:1580323
Created January 9, 2012 00:51
combust exception for Cogito
2012-01-08 17:51:17 [INFO] false
2012-01-08 17:51:17 [SEVERE] java.lang.Exception
2012-01-08 17:51:17 [SEVERE] at edgruberman.bukkit.simpledeathnotices.DamageR
eport.recordCombuster(DamageReport.java:183)
2012-01-08 17:51:17 [SEVERE] at edgruberman.bukkit.simpledeathnotices.DeathMo
nitor.onEntityCombust(DeathMonitor.java:53)
2012-01-08 17:51:17 [SEVERE] at org.bukkit.plugin.java.JavaPluginLoader$66.ex
ecute(JavaPluginLoader.java:727)
2012-01-08 17:51:17 [SEVERE] at org.bukkit.plugin.RegisteredListener.callEven
t(RegisteredListener.java:62)