13
0
geforkt von Mirrors/Paper

Merge branch 'master' of github.com:Bukkit/CraftBukkit

Dieser Commit ist enthalten in:
Dinnerbone 2011-02-21 21:27:01 +00:00
Commit 67cf646014
21 geänderte Dateien mit 250 neuen und 52 gelöschten Zeilen

Datei anzeigen

@ -18,13 +18,13 @@
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://artifacts.lukegb.com/artifactory/repo</url>
<url>http://repo.bukkit.org/artifactory/repo</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bukkit-plugins</id>
<url>http://artifacts.lukegb.com/artifactory/plugins-release</url>
<url>http://repo.bukkit.org/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
<dependencies>

Datei anzeigen

@ -167,7 +167,7 @@ public class BlockButton extends Block {
if (j1 == 0) {
return true;
} else {
//Allow the lever to change the current
//Allow the button to change the current
int old = (j1 != 8) ? 1 : 0;
int current = (j1 == 8) ? 1 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
@ -243,6 +243,15 @@ public class BlockButton extends Block {
int l = world.getData(i, j, k);
if ((l & 8) != 0) {
// Craftbukkit start
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
server.getPluginManager().callEvent(eventRedstone);
if (eventRedstone.getNewCurrent() > 0) return;
// Craftbukkit end
world.c(i, j, k, l & 7);
world.h(i, j, k, this.id);
int i1 = l & 7;

Datei anzeigen

@ -4,7 +4,8 @@ import java.util.List;
import java.util.Random;
// CraftBukkit start
import org.bukkit.block.BlockFace;import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
@ -115,6 +116,15 @@ public class BlockPressurePlate extends Block {
flag1 = true;
}
// Craftbukkit start
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
server.getPluginManager().callEvent(eventRedstone);
flag1 = eventRedstone.getNewCurrent() > 0;
// Craftbukkit end
if (flag1 && !flag) {
world.c(i, j, k, 1);
world.h(i, j, k, this.id);

Datei anzeigen

@ -6,6 +6,8 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import org.bukkit.craftbukkit.CraftWorld;
public class Chunk {
public static boolean a;
@ -44,8 +46,12 @@ public class Chunk {
}
// CraftBukkit start
CraftWorld cw = ((WorldServer) world).getWorld();
bukkitChunk = (cw == null) ? null:cw.popPreservedChunk( i, j );
if (bukkitChunk == null) {
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk( this );
}
}
public org.bukkit.Chunk bukkitChunk;
// CraftBukkit end

Datei anzeigen

@ -10,15 +10,16 @@ import java.util.Set;
// CraftBukkit start
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Type;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
// CraftBukkit end
public class ChunkProviderServer implements IChunkProvider {
public LongHashset a = new LongHashset(); // CraftBukkit
private Chunk b;
private IChunkProvider c;
@ -197,17 +198,24 @@ public class ChunkProviderServer implements IChunkProvider {
public boolean a() {
if (!this.g.C) {
// CraftBukkit start
Server server = g.getServer();
while (!this.a.isEmpty()) {
long chunkcoordinates = this.a.popFirst();
Chunk chunk = e.get(chunkcoordinates);
if (chunk == null) continue;
ChunkUnloadEvent cue = new ChunkUnloadEvent(Type.CHUNK_UNLOADED, chunk.bukkitChunk);
server.getPluginManager().callEvent(cue);
if (!cue.isCancelled()) {
g.getWorld().preserveChunk( (CraftChunk) chunk.bukkitChunk );
chunk.e();
this.b(chunk);
this.a(chunk);
this.a.remove(chunkcoordinates);
this.e.remove(chunkcoordinates);
this.f.remove(chunk);
}
}
// CraftBukkit end
if (this.d != null) {

Datei anzeigen

@ -4,6 +4,7 @@ package net.minecraft.server;
import org.bukkit.craftbukkit.entity.CraftMonster;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@ -118,7 +119,7 @@ public class EntityCreature extends EntityLiving {
double d1 = vec3d.a - this.locX;
double d2 = vec3d.c - this.locZ;
double d3 = vec3d.b - (double) l1;
float f4 = (float) (Math.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f5 = f4 - this.yaw;
for (this.by = this.bC; f5 < -180.0F; f5 += 360.0F) {

Datei anzeigen

@ -4,6 +4,7 @@ import java.util.List;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.craftbukkit.entity.CraftItemDrop;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -124,7 +125,7 @@ public abstract class EntityHuman extends EntityLiving {
this.as = this.at;
super.o();
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
float f1 = (float) Math.atan(-this.motY * 0.20000000298023224D) * 15.0F;
float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F;
if (f > 0.1F) {
f = 0.1F;

Datei anzeigen

@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@ -236,7 +237,7 @@ public abstract class EntityLiving extends Entity {
if (f > 0.05F) {
f3 = 1.0F;
f2 = f * 3.0F;
f1 = (float) Math.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
}
if (this.aY > 0.0F) {

Datei anzeigen

@ -29,9 +29,8 @@ public class Explosion {
public Entity e;
public float f;
public Set g = new HashSet();
// Craftbukkit start
public boolean wasCanceled = false;
// Craftbukkit end
public boolean wasCanceled = false; // Craftbukkit
public Explosion(World world, Entity entity, double d0, double d1, double d2, float f) {
this.i = world;
@ -240,7 +239,7 @@ public class Explosion {
}
if (i1 > 0) {
Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), 0.3F);
Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), event.getYield()); // Craftbukkit
this.i.e(j, k, l, 0);
Block.byId[i1].a_(this.i, j, k, l);
}

Datei anzeigen

@ -398,11 +398,11 @@ public class MinecraftServer implements ICommandListener, Runnable {
s2 = s.substring(s.indexOf(" ")).trim();
this.f.e(s2);
this.a(s1, "Opping " + s2);
this.f.a(s2, "§eYou are now op!");
this.f.a(s2, "\u00A7eYou are now op!");
} else if (s.toLowerCase().startsWith("deop ")) {
s2 = s.substring(s.indexOf(" ")).trim();
this.f.f(s2);
this.f.a(s2, "§eYou are no longer op!");
this.f.a(s2, "\u00A7eYou are no longer op!");
this.a(s1, "De-opping " + s2);
} else if (s.toLowerCase().startsWith("ban-ip ")) {
s2 = s.substring(s.indexOf(" ")).trim();
@ -507,14 +507,14 @@ public class MinecraftServer implements ICommandListener, Runnable {
} else if (s.toLowerCase().startsWith("say ")) {
s = s.substring(s.indexOf(" ")).trim();
a.info("[" + s1 + "] " + s);
this.f.a((Packet) (new Packet3Chat("§d[Server] " + s)));
this.f.a((Packet) (new Packet3Chat("\u00A7d[Server] " + s)));
} else if (s.toLowerCase().startsWith("tell ")) {
astring = s.split(" ");
if (astring.length >= 3) {
s = s.substring(s.indexOf(" ")).trim();
s = s.substring(s.indexOf(" ")).trim();
a.info("[" + s1 + "->" + astring[1] + "] " + s);
s = "§7" + s1 + " whispers " + s;
s = "\u00A77" + s1 + " whispers " + s;
a.info(s);
if (!this.f.a(astring[1], (Packet) (new Packet3Chat(s)))) {
icommandlistener.b("There\'s no player by that name online.");
@ -554,7 +554,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
private void a(String s, String s1) {
String s2 = s + ": " + s1;
this.f.i("§7(" + s2 + ")");
this.f.i("\u00A77(" + s2 + ")");
a.info(s2);
}

Datei anzeigen

@ -82,7 +82,7 @@ public class NetLoginHandler extends NetHandler {
// Craftbukkit start
netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.u, (byte) entityplayer.world.q.g)));
netserverhandler.b((Packet) (new Packet6SpawnPosition(entityplayer.world.spawnX, entityplayer.world.spawnY, entityplayer.world.spawnZ)));
this.e.f.a((Packet) (new Packet3Chat("§e" + entityplayer.name + " joined the game.")));
this.e.f.a((Packet) (new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")));
this.e.f.a(entityplayer);
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.e.c.a(netserverhandler);

Datei anzeigen

@ -17,6 +17,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.TextWrapper;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockDamageEvent;
@ -82,7 +83,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(String s) {
// CraftBukkit start
String leaveMessage = "§e" + this.e.name + " left the game.";
String leaveMessage = "\u00A7e" + this.e.name + " left the game.";
PlayerKickEvent kickEvent = new PlayerKickEvent(org.bukkit.event.Event.Type.PLAYER_KICK, server.getPlayer(this.e), s, leaveMessage);
server.getPluginManager().callEvent(kickEvent);
if (kickEvent.isCancelled()) {
@ -550,7 +551,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(String s, Object[] aobject) {
a.info(this.e.name + " lost connection: " + s);
this.d.f.a((Packet) (new Packet3Chat("§e" + this.e.name + " left the game.")));
this.d.f.a((Packet) (new Packet3Chat("\u00A7e" + this.e.name + " left the game.")));
this.d.f.c(this.e);
this.c = true;
}
@ -608,10 +609,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (event.isCancelled()) {
return true;
}
// CraftBukkit end
a.info(msg);
this.d.f.a((Packet) (new Packet3Chat(msg)));
for (final String line: TextWrapper.wrapText(msg)) {
this.d.f.a((Packet) (new Packet3Chat(line)));
}
// CraftBukkit end
}
return false;
@ -622,7 +625,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start
CraftPlayer player = getPlayer();
PlayerChatEvent event = new PlayerChatEvent(Type.PLAYER_COMMAND, player, s);
PlayerChatEvent event = new PlayerChatEvent(Type.PLAYER_COMMAND_PREPROCESS, player, s);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
@ -641,6 +644,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (targetPluginFound) {
return;
}
// Legacy command handler
event = new PlayerChatEvent(Type.PLAYER_COMMAND, player, s);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
s = event.getMessage();
player = (CraftPlayer) event.getPlayer();
EntityPlayer e = player.getHandle();
@ -658,10 +669,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (astring.length >= 3) {
s = s.substring(s.indexOf(" ")).trim();
s = s.substring(s.indexOf(" ")).trim();
s = "§7" + this.e.name + " whispers " + s;
s = "\u00A77" + this.e.name + " whispers " + s;
a.info(s + " to " + astring[1]);
if (!this.d.f.a(astring[1], (Packet) (new Packet3Chat(s)))) {
this.b((Packet) (new Packet3Chat("§cThere\'s no player by that name online.")));
this.b((Packet) (new Packet3Chat("\u00A7cThere\'s no player by that name online.")));
}
}
} else {
@ -718,7 +729,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
public void b(String s) {
this.b((Packet) (new Packet3Chat("§7" + s)));
this.b((Packet) (new Packet3Chat("\u00A77" + s)));
}
public String c() {

Datei anzeigen

@ -834,6 +834,8 @@ public class World implements IBlockAccess {
type = MobType.SPIDER;
} else if (entity instanceof EntityZombie) {
type = MobType.ZOMBIE;
} else if (entity instanceof EntitySlime) {
type = MobType.SLIME;
}
if (type != null) {

Datei anzeigen

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import net.minecraft.server.WorldServer;
@ -11,27 +12,38 @@ import org.bukkit.block.Block;
import org.bukkit.craftbukkit.block.CraftBlock;
public class CraftChunk implements Chunk {
private final net.minecraft.server.Chunk chunk;
private WeakReference<net.minecraft.server.Chunk> weakChunk;
private final HashMap<Integer, Block> cache = new HashMap<Integer, Block>();
private WorldServer worldServer;
private int x;
private int z;
public CraftChunk(net.minecraft.server.Chunk chunk) {
this.chunk = chunk;
this.weakChunk = new WeakReference<net.minecraft.server.Chunk>(chunk);
worldServer = (WorldServer) getHandle().d;
x = getHandle().j;
z = getHandle().k;
}
public World getWorld() {
return ((WorldServer) chunk.d).getWorld();
return worldServer.getWorld();
}
public net.minecraft.server.Chunk getHandle() {
return chunk;
net.minecraft.server.Chunk c = weakChunk.get();
if (c == null) {
weakChunk = new WeakReference<net.minecraft.server.Chunk>(worldServer.c(x,z));
c = weakChunk.get();
}
return c;
}
public int getX() {
return chunk.j;
return x;
}
public int getZ() {
return chunk.k;
return z;
}
@Override
@ -49,3 +61,4 @@ public class CraftChunk implements Chunk {
return block;
}
}

Datei anzeigen

@ -28,6 +28,7 @@ public class CraftWorld implements World {
private final Environment environment;
private final CraftServer server;
private final ChunkProviderServer provider;
private HashMap<Integer,CraftChunk> unloadedChunks = new HashMap<Integer, CraftChunk>();
private static final Random rand = new Random();
@ -45,6 +46,14 @@ public class CraftWorld implements World {
server.addWorld(this);
}
public void preserveChunk( CraftChunk chunk ) {
unloadedChunks.put( (chunk.getX() << 16) + chunk.getZ(), chunk );
}
public CraftChunk popPreservedChunk( int x, int z ) {
return unloadedChunks.remove( (x << 16) + z );
}
public Block getBlockAt(int x, int y, int z) {
return getChunkAt(x >> 4, z >> 4).getBlock(x & 0xF, y & 0x7F, z & 0xF);
}

Datei anzeigen

@ -0,0 +1,60 @@
package org.bukkit.craftbukkit;
public class TextWrapper {
private static final int[] characterWidths = new int[] {
1, 9, 9, 8, 8, 8, 8, 7, 9, 8, 9, 9, 8, 9, 9, 9,
8, 8, 8, 8, 9, 9, 8, 9, 8, 8, 8, 8, 8, 9, 9, 9,
4, 2, 5, 6, 6, 6, 6, 3, 5, 5, 5, 6, 2, 6, 2, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 5, 6, 5, 6,
7, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 4, 6, 6,
3, 6, 6, 6, 6, 6, 5, 6, 6, 2, 6, 5, 3, 6, 6, 6,
6, 6, 6, 6, 4, 6, 6, 6, 6, 6, 6, 5, 2, 5, 7, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 3, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6,
6, 3, 6, 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 2, 6, 6,
8, 9, 9, 6, 6, 6, 8, 8, 6, 8, 8, 8, 8, 8, 6, 6,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 9, 9, 9, 5, 9, 9,
8, 7, 7, 8, 7, 8, 8, 8, 7, 8, 8, 7, 9, 9, 6, 7,
7, 7, 7, 7, 9, 6, 7, 8, 7, 6, 6, 9, 7, 6, 7, 1
};
private static final int CHAT_WINDOW_WIDTH = 318;
public static String[] wrapText(final String text) {
final StringBuilder out = new StringBuilder();
char colorChar = 'f';
int lineWidth = 0;
boolean hasColored = true;
for (int i = 0; i < text.length(); i++) {
char ch = text.charAt(i);
if (ch == '\u00A7' && i < text.length() - 1) {
i++;
colorChar = text.charAt(i);
hasColored = false;
continue;
} else if (ch >= characterWidths.length) {
ch = (char) (characterWidths.length - 1);
}
final int width = characterWidths[(int) ch];
if (lineWidth + width >= CHAT_WINDOW_WIDTH) {
out.append('\n');
if (colorChar != 'f') {
out.append('\u00A7');
out.append(colorChar);
}
out.append(ch);
lineWidth = width;
} else {
if (!hasColored) {
out.append('\u00A7');
out.append(colorChar);
hasColored = true;
}
out.append(ch);
lineWidth += width;
}
}
return out.toString().split("\n");
}
}

Datei anzeigen

@ -0,0 +1,46 @@
package org.bukkit.craftbukkit;
/**
* Credits for this class goes to user aioobe on stackoverflow.com
* Source: http://stackoverflow.com/questions/4454630/j2me-calculate-the-the-distance-between-2-latitude-and-longitude
*
*/
public class TrigMath {
static final double sq2p1 = 2.414213562373095048802e0;
static final double sq2m1 = .414213562373095048802e0;
static final double p4 = .161536412982230228262e2;
static final double p3 = .26842548195503973794141e3;
static final double p2 = .11530293515404850115428136e4;
static final double p1 = .178040631643319697105464587e4;
static final double p0 = .89678597403663861959987488e3;
static final double q4 = .5895697050844462222791e2;
static final double q3 = .536265374031215315104235e3;
static final double q2 = .16667838148816337184521798e4;
static final double q1 = .207933497444540981287275926e4;
static final double q0 = .89678597403663861962481162e3;
static final double PIO2 = 1.5707963267948966135E0;
private static double mxatan(double arg) {
double argsq = arg * arg, value;
value = ((((p4 * argsq + p3) * argsq + p2) * argsq + p1) * argsq + p0);
value = value / (((((argsq+q4)*argsq+q3)*argsq+q2)*argsq+q1)*argsq+q0);
return value * arg;
}
private static double msatan(double arg) {
return arg < sq2m1 ? mxatan(arg)
: arg > sq2p1 ? PIO2 - mxatan(1 / arg)
: PIO2 / 2 + mxatan((arg - 1) / (arg + 1));
}
public static double atan(double arg) {
return arg > 0 ? msatan(arg) : -msatan(-arg);
}
public static double atan2(double arg1, double arg2) {
if (arg1 + arg2 == arg1)
return arg1 >= 0 ? PIO2 : -PIO2;
arg1 = atan(arg1 / arg2);
return arg2 < 0 ? arg1 <= 0 ? arg1 + Math.PI : arg1 - Math.PI : arg1;
}
}

Datei anzeigen

@ -46,7 +46,6 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityGiantZombie) { return new CraftGiant( server, (EntityGiantZombie) entity); }
else if (entity instanceof EntitySkeleton) { return new CraftSkeleton( server, (EntitySkeleton) entity); }
else if (entity instanceof EntitySpider) { return new CraftSpider( server, (EntitySpider) entity); }
else if (entity instanceof EntitySlime) { return new CraftSlime( server, (EntitySlime) entity); }
else { return new CraftMonster( server, (EntityMonster) entity); }
}
@ -57,6 +56,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
else { return new CraftCreature( server, (EntityCreature) entity); }
}
// Slimes are a special (and broken) case
else if (entity instanceof EntitySlime) { return new CraftSlime( server, (EntitySlime) entity); }
// Flying
else if (entity instanceof EntityFlying) {
if (entity instanceof EntityGhast) { return new CraftGhast( server, (EntityGhast) entity); }
@ -130,6 +131,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
entity.fireTicks = ticks;
}
public void remove() {
entity.dead = true;
}
public Entity getHandle() {
return entity;
}

Datei anzeigen

@ -14,6 +14,7 @@ import net.minecraft.server.WorldServer;
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.TextWrapper;
import org.bukkit.entity.Player;
public class CraftPlayer extends CraftHumanEntity implements Player {
@ -80,7 +81,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void sendMessage(String message) {
entity.a.b(new Packet3Chat(message));
for (final String line: TextWrapper.wrapText(message)) {
entity.a.b(new Packet3Chat(line));
}
}
public String getDisplayName() {

Datei anzeigen

@ -223,4 +223,18 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
public boolean isCurrentlyRunning(int taskId){
return craftThreadManager.isAlive(taskId);
}
public boolean isQueued(int taskId) {
synchronized (schedulerQueue) {
Iterator<CraftTask> itr = schedulerQueue.keySet().iterator();
while (itr.hasNext()) {
CraftTask current = itr.next();
if (current.getIdNumber() == taskId) {
return true;
}
}
return false;
}
}
}

Datei anzeigen

@ -61,8 +61,8 @@ public class CraftThreadManager {
return craftWorker.isAlive();
}
}
}
// didn't find it, so it must have been removed
return false;
}
}
}