Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace fCraft
{
class PropHunt
{
private string[] blockId = {"1", "2", "4", "5", "7", "12", "13", "17", "19", "64", "65"};
public static void PlayerMovedSolid(object var, fCraft.Events.PlayerMovingEventArgs e)
{
if (e.Player.Info.isSolidBlock == false)
{
TimeSpan idle = e.Player.IdleTime;
if (idle.TotalSeconds > 5)
{
e.Player.Info.IsHidden = true;
e.Player.Info.isSolidBlock = true;
//Somehow place a block at the players current pos. block number is e.Player.Model (string)
public static void CheckIdles(object sender, fCraft.Events.PlayerMovingEventArgs e)
{
if (e.Player.IdleTime.ToSeconds() % 5 == 0 && e.Player.IdleTime.ToSeconds() == 5 && !e.Player.isSolidBlock)
{
//Temp debug message
Server.Message("{0} is idle!", e.Player.ClassyName);
e.Player.Info.IsHidden = true;
e.Player.isSolidBlock = true;
// Modifications Copyright (c) 2013 Michael Cummings <michael.cummings.97@outlook.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
foreach (Player p in PropHunt._world.Players)
{
Block[] blockNames = { Block.Stone, Block.Grass, Block.Dirt, Block.Cobblestone, Block.Plank, Block.Bedrock, Block.Sand, Block.Gravel, Block.Log, Block.Sponge, Block.Crate, Block.StoneBrick };
if (map.GetBlock(p.prophuntLastSolidPos) == blockNames)
{
//Remove the players block
Block airBlock = Block.Air;
BlockUpdate blockUpdate = new BlockUpdate(null, this.prophuntLastSolidPos, airBlock);
this.World.Map.QueueUpdate(blockUpdate);
string targetName = cmd.Next();
if( targetName == null ) {
//Displays Usage if the Player Does not Properly Write the Command
CdNuke.PrintUsage( player );
return;
}
PlayerInfo target = PlayerDB.FindPlayerInfoOrPrintMatches( player, targetName );
string reason = cmd.NextAll();
java.lang.ArrayIndexOutOfBoundsException: -1
at com.mojang.minecraft.level.Level.netSetTileNoNeighborChange(Level.java:923)
at com.mojang.minecraft.level.Level.netSetTile(Level.java:897)
at com.mojang.minecraft.Minecraft.tick(Minecraft.java:2417)
at com.mojang.minecraft.Minecraft.run(Minecraft.java:815)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at com.mojang.minecraft.Minecraft.tick(Minecraft.java:2615)
at com.mojang.minecraft.Minecraft.run(Minecraft.java:815)
at java.lang.Thread.run(Unknown Source)
// Checks if the seeker tagged a player, after they broke the block form
public static void PlayerMoved(object sender, fCraft.Events.PlayerMovingEventArgs e)
{
if (e.Player.isPropHuntSeeker)
{
Vector3I oldPos = new Vector3I(e.OldPosition.X / 32, e.OldPosition.Y / 32, e.OldPosition.Z / 32); // Get the position of the player
Vector3I newPos = new Vector3I(e.NewPosition.X / 32, e.NewPosition.Y / 32, e.NewPosition.Z / 32);
if (oldPos.X != newPos.X || oldPos.Y != newPos.Y || oldPos.Z != newPos.Z) // Check if the positions are not the same (player moved)
{
// Modifications Copyright (c) <2013 - 2014> Michael Cummings <michael.cummings.97@outlook.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
if ((tempAttr = el.Attribute("prop-hunt")) != null)
{
bool isPropHunt;
if (Boolean.TryParse(tempAttr.Value, out isPropHunt))
{
world.IsPropHunt = isPropHunt;
PropHuntWorlds.Add(world);
}
else
{