Skip to content

Commit

Permalink
[Experimental] show_endcredits mech
Browse files Browse the repository at this point in the history
Boo packet magic, but yay player control.
  • Loading branch information
mcmonkey4eva committed Nov 24, 2014
1 parent 229e2cc commit cf5047e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -17,8 +17,10 @@
import net.aufdemrand.denizen.utilities.packets.PlayerBars;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.npc.NPC;
import net.minecraft.server.v1_7_R4.PacketPlayOutGameStateChange;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
Expand Down Expand Up @@ -2182,6 +2184,19 @@ else if (split.length > 1) {
ItemChangeMessage.sendMessage(getPlayerEntity(), value.asString());
}

// <--[mechanism]
// @object dPlayer
// @name show_endcredits
// @input None
// @description
// Shows the player the end credits.
// -->
if (mechanism.matches("show_endcredits")) {
((CraftPlayer)getPlayerEntity()).getHandle().viewingCredits = true;
((CraftPlayer)getPlayerEntity()).getHandle().playerConnection
.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
}

// Iterate through this object's properties' mechanisms
for (Property property : PropertyParser.getProperties(this)) {
property.adjust(mechanism);
Expand Down

0 comments on commit cf5047e

Please sign in to comment.