Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
4,329 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>denizen-parent</artifactId> | ||
<groupId>net.aufdemrand</groupId> | ||
<version>1.0.1-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>denizen-v1_11_R1</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>net.aufdemrand</groupId> | ||
<artifactId>denizen-nmshandler</artifactId> | ||
<version>${project.parent.version}</version> | ||
<scope>compile</scope> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.aufdemrand</groupId> | ||
<artifactId>denizencore</artifactId> | ||
<version>1.05</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot-api</artifactId> | ||
<version>1.11-R0.1-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot</artifactId> | ||
<version>1.11-R0.1-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
209 changes: 209 additions & 0 deletions
209
v1_11_R1/src/main/java/net/aufdemrand/denizen/nms/Handler_v1_11_R1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
package net.aufdemrand.denizen.nms; | ||
|
||
import com.google.common.collect.Iterables; | ||
import com.mojang.authlib.GameProfile; | ||
import com.mojang.authlib.properties.Property; | ||
import net.aufdemrand.denizen.nms.abstracts.AnimationHelper; | ||
import net.aufdemrand.denizen.nms.abstracts.BiomeNMS; | ||
import net.aufdemrand.denizen.nms.abstracts.BlockLight; | ||
import net.aufdemrand.denizen.nms.abstracts.ParticleHelper; | ||
import net.aufdemrand.denizen.nms.abstracts.ProfileEditor; | ||
import net.aufdemrand.denizen.nms.abstracts.Sidebar; | ||
import net.aufdemrand.denizen.nms.helpers.*; | ||
import net.aufdemrand.denizen.nms.impl.BiomeNMS_v1_11_R1; | ||
import net.aufdemrand.denizen.nms.impl.ProfileEditor_v1_11_R1; | ||
import net.aufdemrand.denizen.nms.impl.Sidebar_v1_11_R1; | ||
import net.aufdemrand.denizen.nms.impl.blocks.BlockLight_v1_11_R1; | ||
import net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_11_R1; | ||
import net.aufdemrand.denizen.nms.impl.packets.handlers.DenizenPacketListener_v1_11_R1; | ||
import net.aufdemrand.denizen.nms.interfaces.*; | ||
import net.aufdemrand.denizen.nms.interfaces.packets.PacketHandler; | ||
import net.aufdemrand.denizen.nms.util.PlayerProfile; | ||
import net.aufdemrand.denizen.nms.util.jnbt.CompoundTag; | ||
import net.aufdemrand.denizen.nms.util.jnbt.Tag; | ||
import net.aufdemrand.denizencore.utilities.debugging.dB; | ||
import net.minecraft.server.v1_11_R1.MinecraftServer; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.Location; | ||
import org.bukkit.block.Biome; | ||
import org.bukkit.craftbukkit.v1_11_R1.CraftServer; | ||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.Map; | ||
|
||
public class Handler_v1_11_R1 extends NMSHandler { | ||
|
||
private final AnimationHelper animationHelper = new AnimationHelper_v1_11_R1(); | ||
private final BlockHelper blockHelper = new BlockHelper_v1_11_R1(); | ||
private final ChunkHelper chunkHelper = new ChunkHelper_v1_11_R1(); | ||
private final CustomEntityHelper customEntityHelper = new CustomEntityHelper_v1_11_R1(); | ||
private final EntityHelper entityHelper = new EntityHelper_v1_11_R1(); | ||
private final FishingHelper fishingHelper = new FishingHelper_v1_11_R1(); | ||
private final ItemHelper itemHelper = new ItemHelper_v1_11_R1(); | ||
private final SoundHelper soundHelper = new SoundHelper_v1_11_R1(); | ||
private final PacketHelper packetHelper = new PacketHelper_v1_11_R1(); | ||
private final ParticleHelper particleHelper = new ParticleHelper_v1_11_R1(); | ||
private final PlayerHelper playerHelper = new PlayerHelper_v1_11_R1(); | ||
private final WorldHelper worldHelper = new WorldHelper_v1_11_R1(); | ||
|
||
private final ProfileEditor profileEditor = new ProfileEditor_v1_11_R1(); | ||
|
||
@Override | ||
public Thread getMainThread() { | ||
return ((CraftServer) Bukkit.getServer()).getServer().primaryThread; | ||
} | ||
|
||
@Override | ||
public double[] getRecentTps() { | ||
return ((CraftServer) Bukkit.getServer()).getServer().recentTps; | ||
} | ||
|
||
@Override | ||
public AnimationHelper getAnimationHelper() { | ||
return animationHelper; | ||
} | ||
|
||
@Override | ||
public BlockHelper getBlockHelper() { | ||
return blockHelper; | ||
} | ||
|
||
@Override | ||
public ChunkHelper getChunkHelper() { | ||
return chunkHelper; | ||
} | ||
|
||
@Override | ||
public CustomEntityHelper getCustomEntityHelper() { | ||
return customEntityHelper; | ||
} | ||
|
||
@Override | ||
public EntityHelper getEntityHelper() { | ||
return entityHelper; | ||
} | ||
|
||
@Override | ||
public FishingHelper getFishingHelper() { | ||
return fishingHelper; | ||
} | ||
|
||
@Override | ||
public ItemHelper getItemHelper() { | ||
return itemHelper; | ||
} | ||
|
||
@Override | ||
public SoundHelper getSoundHelper() { | ||
return soundHelper; | ||
} | ||
|
||
@Override | ||
public PacketHelper getPacketHelper() { | ||
return packetHelper; | ||
} | ||
|
||
@Override | ||
public ParticleHelper getParticleHelper() { | ||
return particleHelper; | ||
} | ||
|
||
@Override | ||
public PlayerHelper getPlayerHelper() { | ||
return playerHelper; | ||
} | ||
|
||
@Override | ||
public WorldHelper getWorldHelper() { | ||
return worldHelper; | ||
} | ||
|
||
@Override | ||
public void enablePacketInterception(PacketHandler packetHandler) { | ||
DenizenPacketListener_v1_11_R1.enable(packetHandler); | ||
} | ||
|
||
@Override | ||
public CompoundTag createCompoundTag(Map<String, Tag> value) { | ||
return new CompoundTag_v1_11_R1(value); | ||
} | ||
|
||
@Override | ||
public Sidebar createSidebar(Player player) { | ||
return new Sidebar_v1_11_R1(player); | ||
} | ||
|
||
@Override | ||
public BlockLight createBlockLight(Location location, int lightLevel, long ticks) { | ||
return BlockLight_v1_11_R1.createLight(location, lightLevel, ticks); | ||
} | ||
|
||
@Override | ||
public PlayerProfile fillPlayerProfile(PlayerProfile playerProfile) { | ||
try { | ||
if (playerProfile != null) { | ||
GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName()); | ||
gameProfile.getProperties().get("textures").clear(); | ||
if (playerProfile.getTextureSignature() != null) { | ||
gameProfile.getProperties().put("textures", new Property("value", playerProfile.getTexture(), playerProfile.getTextureSignature())); | ||
} | ||
else { | ||
gameProfile.getProperties().put("textures", new Property("value", playerProfile.getTexture())); | ||
} | ||
MinecraftServer minecraftServer = ((CraftServer) Bukkit.getServer()).getServer(); | ||
GameProfile gameProfile1 = null; | ||
if (gameProfile.getId() != null) { | ||
gameProfile1 = minecraftServer.getUserCache().a(gameProfile.getId()); | ||
} | ||
if (gameProfile1 == null && gameProfile.getName() != null) { | ||
gameProfile1 = minecraftServer.getUserCache().getProfile(gameProfile.getName()); | ||
} | ||
if (gameProfile1 == null) { | ||
gameProfile1 = gameProfile; | ||
} | ||
if (playerProfile.hasTexture()) { | ||
gameProfile1.getProperties().get("textures").clear(); | ||
if (playerProfile.getTextureSignature() != null) { | ||
gameProfile1.getProperties().put("textures", new Property("value", playerProfile.getTexture(), playerProfile.getTextureSignature())); | ||
} | ||
else { | ||
gameProfile1.getProperties().put("textures", new Property("value", playerProfile.getTexture())); | ||
} | ||
} | ||
if (Iterables.getFirst(gameProfile1.getProperties().get("textures"), null) == null) { | ||
gameProfile1 = minecraftServer.az().fillProfileProperties(gameProfile1, true); | ||
} | ||
Property property = Iterables.getFirst(gameProfile1.getProperties().get("textures"), null); | ||
return new PlayerProfile(gameProfile1.getName(), gameProfile1.getId(), | ||
property != null ? property.getValue() : null, | ||
property != null ? property.getSignature() : null); | ||
} | ||
} | ||
catch (Exception e) { | ||
if (dB.verbose) { | ||
dB.echoError(e); | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public PlayerProfile getPlayerProfile(Player player) { | ||
GameProfile gameProfile = ((CraftPlayer) player).getProfile(); | ||
Property property = Iterables.getFirst(gameProfile.getProperties().get("textures"), null); | ||
return new PlayerProfile(gameProfile.getName(), gameProfile.getId(), | ||
property != null ? property.getValue() : null, | ||
property != null ? property.getSignature() : null); | ||
} | ||
|
||
@Override | ||
public ProfileEditor getProfileEditor() { | ||
return profileEditor; | ||
} | ||
|
||
@Override | ||
public BiomeNMS getBiomeNMS(Biome biome) { | ||
return new BiomeNMS_v1_11_R1(biome); | ||
} | ||
} |
Oops, something went wrong.