Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using System.Collections.Generic;
using System.Threading.Tasks;
using MiNET;
using MiNET.BlockEntities;
using MiNET.Blocks;
using MiNET.Utils;
using MiNET.Worlds;
namespace TestPlugin.MobHunt
public class CustomStandingSign : StandingSign
private static readonly Dictionary<string, Level> Worlds = new Dictionary<string, Level>();
public override bool Interact(Level currentLevel, Player player, BlockCoordinates blockCoordinates, BlockFace face)
Sign signEntity = currentLevel.GetBlockEntity(blockCoordinates) as Sign;
if (signEntity == null) return false;
string world = signEntity.Text1;
if (player.Level.LevelId.Equals(world)) return true;
if (!Worlds.ContainsKey(player.Level.LevelId))
Worlds.Add(player.Level.LevelId, player.Level);
if (!Worlds.ContainsKey(world))
Worlds.Add(world, new MobHuntLevel(world, new FlatlandWorldProvider()));
Level level = Worlds[world];
new Task(() => player.SpawnLevel(level)).Start();
level.BroadcastTextMessage(string.Format("{0} teleported to world <{1}>.", player.Username, level.LevelId));
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment