ModMode.sk

Created by Unknown

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

#Skript / SkQuery / Skellet / TuSKe
	
function giveModItems(p: player):
	clear {_p}'s inventory
	wait tick
	set slot 0 of {_p} to compass named "&bTeleport Compass"
	set slot 1 of {_p} to chest named "&bPlayer Inspector"
	set slot 2 of {_p} to diamond pickaxe named "&bMining Players"
	set slot 4 of {_p} to player head named "&bMM List"
	set slot 6 of {_p} to clock named "&bSettings & Utilities"
	set slot 7 of {_p} to gray dye named "&bVanish"
	set slot 8 of {_p} to music disc named "&bRandom Player TP"
	apply potion of night vision to {_p} for 9999 seconds

function vanish(p: player, s: string):
	if {_s} is "on":
		hide {_p} to all players
		loop {modmode::*}:
			set {_moderators} to loop-index
			reveal {_p} to {_moderators}
		wait tick
		set slot 7 of {_p} to light green dye named "&aVanish"
		send "&8[&b&lMM&8] &6Toggle Vanish &aENABLED&6!" to {_p}
	else if {_s} is "off":
		reveal {_p} to all players
		wait tick
		set slot 7 of {_p} to gray dye named "&bVanish"
		send "&8[&b&lMM&8] &6Toggle Vanish &cDISABLED&6!" to {_p}

function giveLastInventory(p: player, s: string):
	if {_s} is "restore":
		set {_uuid} to {_p}'s uuid
		set {_count} to 0
		loop 36 times:
			set slot {_count} of {_p}'s inventory to {modmode::inventory::%{_uuid}%::%{_count}%}
			add 1 to {_count}
		set {_p}'s helmet to {modmode::helmet::%{_uuid}%}
		set {_p}'s chestplate to {modmode::chestplate::%{_uuid}%}
		set {_p}'s leggings to {modmode::leggings::%{_uuid}%}
		set {_p}'s boots to {modmode::boots::%{_uuid}%}
		delete {modmode::inventory::%{_uuid}%::*}
		delete {modmode::helmet::%{_uuid}%}
		delete {modmode::chestplate::%{_uuid}%}
		delete {modmode::leggings::%{_uuid}%}
		delete {modmode::boots::%{_uuid}%}
	else if {_s} is "save":
		set {_uuid} to {_p}'s uuid
		set {_count} to 0
		loop 36 times:
			set {modmode::inventory::%{_uuid}%::%{_count}%} to slot {_count} of {_p}'s inventory
			add 1 to {_count}
		set {modmode::helmet::%{_uuid}%} to {_p}'s helmet
		set {modmode::chestplate::%{_uuid}%} to {_p}'s chestplate
		set {modmode::leggings::%{_uuid}%} to {_p}'s leggings
		set {modmode::boots::%{_uuid}%} to {_p}'s boots
		
function getPlayerInfo(p: player, mod: player):
	open virtual chest inventory with size 6 named "&d&l%{_p}%" to {_mod}
	loop {_p}'s inventory:
		add loop-value to {_inv::*}
		format gui slot (size of {_inv::*} - 1) of {_p} with loop-value
	loop all active potions on {_p}:
		add loop-value to {_potions::*}
	if {_potions::*} is not set:
		set {_potions::*} to "&cThere's no active potions!"
	format gui slot 52 of {_mod} with paper named "&d%{_p}%'s State" with lore "&eGamemode: &f%gamemode of {_p}%", "&eFly Mode: &f%flying state of {_p}%", "&eLocation: &f%location of {_p}%" and "&eWorld: &f%world of {_p}%"
	format gui slot 50 of {_mod} with clock named "&d%{_p}%'s Client Information" with lore "&eUUID: &f%uuid of {_p}%", "&eMinecraft Version: &f%minecraft version of {_p}%", "&eHas been online: &f%online time of {_p}%" and "&eFirst Login: &f%first login of {_p}%"
	format gui slot 48 of {_mod} with glistering melon named "&d%{_p}%'s Health, Hunger and EXP" with lore "&eHealth: &f%health of {_p} * 2%", "&eAbsorption: &f%absorption hearts of {_p}%", "&eHunger: &f%food of {_p}% (%saturation of {_p}% saturation)" and "&eEXP: &f%level of {_p}% (%xp of {_p}% points)"
	format gui slot 46 of {_mod} with brewing stand named "&d%{_p}%'s Potion Effects" with lore "&e%{_potions::*}%"
	
function playerSettings(p: player, s: string):
	set {_uuid} to {_p}'s uuid
	if {_s} is "oresalert":
		if {modmode::oresalert::%{_uuid}%} is not set:
			set {modmode::oresalert::%{_uuid}%} to "Enabled"
			send "&8[&b&lMM&8] &eToggle Ores Alert &aENABLED&6!" to {_p}
		else if {modmode::oresalert::%{_uuid}%} is set:
			delete {modmode::oresalert::%{_uuid}%}
			send "&8[&b&lMM&8] &eToggle Ores Alert &cDISABLED&6!" to {_p}
	else if {_s} is "staffchat":
		if {modmode::staffchat::%{_uuid}%} is not set:
			set {modmode::staffchat::%{_uuid}%} to "Enabled"
			send "&8[&b&lMM&8] &dToggle Staff Chat &aENABLED&6!" to {_p}
		else if {modmode::staffchat::%{_uuid}%} is set:
			delete {modmode::staffchat::%{_uuid}%}
			send "&8[&b&lMM&8] &dToggle Staff Chat &cDISABLED&6!" to {_p}
	else if {_s} is "clearchat":
		loop 99 times:
			broadcast " "
		broadcast "&8[&b&lMM&8] >> &eChat was cleared by a Moderator"
		send "&8[&b&lMM-SC&8] >> &eChat was cleared by %{_p}%" to all players where [player input has permission "modmode.use"]
	else if {_s} is "mutechat":
		if {modmode::mutechat} is not set:
			set {modmode::mutechat} to "Enabled"
			broadcast "&8[&b&lMM&8] >> &eChat was muted by a Moderator"
			send "&8[&b&lMM-SC&8] >> &eChat was muted by %{_p}%" to all players where [player input has permission "modmode.use"]
		else if {modmode::mutechat} is "Enabled":
			delete {modmode::mutechat}
			broadcast "&8[&b&lMM&8] >> &eChat was unmuted by a Moderator"
			send "&8[&b&lMM-SC&8] >> &eChat was unmuted by %{_p}%" to all players where [player input has permission "modmode.use"]
		
		
function clearPlayerVariables(p: player):
	set {_p} to {_p}'s uuid
	delete {check::%{_p}%::*}
	delete {ores::%{_p}%::*}
	delete {modmode::staffchat::%{_p}%}
	delete {modmode::oresalert::%{_p}%}
	
function playerTeleport(p1: player, p2: player):
	teleport {_p1} to {_p2}
	send "&8[&b&lMM&8] &eTeleported to: &a%{_p2}%&e!" to {_p1}
		
on quit:
	clearPlayerVariables(player)
	if {modmode::*} contains player:
		clear player's inventory
		remove NIGHT VISION from player
		vanish(player, "off")
		remove player from {modmode::*}
		giveLastInventory(player, "restore")
		
on inventory click:
	if {modmode::*} contains player:
		cancel event
		
on drop:
	if {modmode::*} contains player:
		cancel event
		
on place:
	if {modmode::*} contains player:
		cancel event
		
on break:
	if {modmode::*} contains player:
		cancel event
		
on pick up:
	if {modmode::*} contains player:
		cancel event

on damage of player:
	if {modmode::*} contains attacker or victim:
		cancel event
	
on rightclick with compass, music disc, gray dye, light green dye, player head, chest, clock or diamond pickaxe:
	if {modmode::*} contains player:
		if name of tool is "&bPlayer Inspector":
			if targeted entity is player:
				set {_target} to targeted entity
				getPlayerInfo({_target}, player)
		else if name of tool is "&bTeleport Compass":
			teleport player to location of target block
		else if name of tool is "&bVanish":
			vanish(player, "on")
		else if name of tool is "&aVanish":
			vanish(player, "off")
		else if name of tool is "&bRandom Player TP":
			set {_random} to a random player out of all players
			if {_random} is player:
				send "&8[&b&lMM&8] &cThere's nobody online"
			else:
				teleport player to {_random}
				send "&8[&b&lMM&8] &eRandomly Teleported to: &a%{_random}%&e!"
		else if name of tool is "&bMining Players":
			open virtual chest inventory with size 6 named "&8[&b&lMM&8] >> Mining Players" to player
			add all players to {_allplayers::*}
			loop {_allplayers::*}:
				set {_list::%loop-value%::*} to y-coordinate of loop-value
				if {_list::%loop-value%::*} <= 40:
					format gui slot (size of {_list::%loop-value%::*} - 1) of player with skull of loop-value named "&d%loop-value%" with lore "&eHeight: &f%{_list::%loop-value%::*}% (%world of loop-value%)", "&eHas been online: &f%online time of loop-value%", "&eMinecraft Version: &f%minecraft version of loop-value%", " " and "&7Left-Click to Teleport" to close then run function playerTeleport(player, loop-value)
		else if name of tool is "&bMM List":
			set {_list::*} to all players where [player input has permission "modmode.use"]
			open virtual chest inventory with size 6 named "&8[&b&lMM&8] >> &eModerators (%size of {_list::*}%)" to player
			loop {_list::*}:
				if loop-value is online:
					format gui slot (size of {_list::*} - 1) of player with skull of loop-value named "&d%loop-value%" with lore "&eHas been online: &f%online time of loop-value%", "&eMinecraft Version: &f%minecraft version of loop-value%", " ", "&eGamemode: &f%gamemode of loop-value% &8- &eFly: &f%flying state of loop-value%", "&eLocation: &f%location of loop-value% (%world of loop-value%)", " " and "&7Left-Click to Teleport" to close then run function playerTeleport(player, loop-value)
				else:
					format gui slot (size of {_list::*} - 1) of player with skull of loop-value named "&d%loop-value%" with lore "&eState: &fOffline"
		else if name of tool is "&bSettings & Utilities":
			open virtual chest inventory with size 2 named "Settings & Utilities" to player
			format gui slot 0 of player with diamond ore named "&dOres Alert" with lore "&eState: &f%{modmode::oresalert::%uuid of player%} ? ""Disabled""%", " " and "&7Left-Click to &aEnable&8/&cDisable" to close then run function playerSettings(player, "oresalert")
			format gui slot 1 of player with book and quill named "&dStaff Chat" with lore "&eState: &f%{modmode::staffchat::%uuid of player%} ? ""Disabled""%", " " and "&7Left-Click to &aEnable&8/&cDisable" to close then run function playerSettings(player, "staffchat")
			format gui slot 16 of player with paper named "&dClear Chat" with lore " " and "&7Left-Click to Clear Chat" to close then run function playerSettings(player, "clearchat")
			format gui slot 17 of player with book named "&dMute Chat" with lore "&eState: &f%{modmode::mutechat} ? ""Disabled""%", " " and "&7Left-Click to &aEnable&8/&cDisable" to close then run function playerSettings(player, "mutechat")
			
on mine of diamond ore, gold ore or iron ore:
	if event-block is diamond ore:
		loop all blocks around event-block in radius 3:
			if loop-block is diamond ore:
				add event-block to {_ores::%player's uuid%::*}
	else if event-block is gold ore:
		loop all blocks around event-block in radius 3:
			if loop-block is gold ore:
				add event-block to {_ores::%player's uuid%::*}
	else if event-block is iron ore:
		loop all blocks around event-block in radius 4:
			if loop-block is iron ore:
				add event-block to {_ores::%player's uuid%::*}
	set {ores::%player's uuid%::*} to {_ores::%player's uuid%::*}
	set {_y} to player's y-coordinate
	if {check::%player's uuid%::*} is not set:
		loop {modmode::oresalert::*}:
			set {_p} to player from uuid loop-index
			add {_p} to {_modmode::oresalert::*}
		send formatted "<tooltip:&6&lClick to Teleport><cmd:/tp %player%>&8[&b&lMM&8] &c%player% &6has found &c&l%size of {_ores::%player's uuid%::*}% &6of &d%event-block% &6in height &e%{_y}%" to {_modmode::oresalert::*}
	set {check::%player's uuid%::*} to (size of {ores::%player's uuid%::*})
	if (size of {ores::%player's uuid%::*}) is greater than 0:
		remove 1 from {check::%player's uuid%::*}
		
on rightclick on chest or shulker box or barrel:
	if {modmode::*} contains player:
		cancel event
		open virtual chest inventory with size 6 named "&8[&b&lMM&8] >> &eSpying Inventory" to player
		loop event-block's inventory:
			add loop-value to {_inv::*}
			format gui slot (size of {_inv::*} - 1) of player with loop-value
		
on chat:
	if {modmode::mutechat} is true:
		if player doesn't have the permission "modmode.use":
			cancel event
			send "&8[&b&lMM&8] &cChat has been muted, you can't talk."
	if {modmode::staffchat::%uuid of player%} is true:
		cancel event
		send "&8[&b&lMM-SC&8] &d%player%: &f%message%" to all players where [player input has permission "modmode.use"]
		
command /modmode [<text>]:
	permission: modmode.use
	permission message: &cDenied permission.
	executable by: players
	aliases: mm
	cooldown: 3 seconds
	cooldown message: &8[&b&lMM&8] &cYou're on command cooldown, please wait &a%remaining time%&c!
	trigger:
		if arg-1 is not set:
			if {modmode::*} contains player:
				apply potion of resistance 9999 to player for 5 seconds
				clear player's inventory
				remove player from {modmode::*}
				set player's gamemode to survival
				remove NIGHT VISION from player
				giveLastInventory(player, "restore")
				send "&8[&b&lMM&8] &6Toggle Moderator &cDISABLED&6, you've &d5 &6seconds of &aimmunity&6!"
				
			else:
				giveLastInventory(player, "save")
				add player to {modmode::*}
				set player's gamemode to creative
				giveModItems(player)
				send "&8[&b&lMM&8] &6Toggle Moderator &aENABLED&6!"
		else if arg-1 is "sc" or "staffchat":
			playerSettings(player, "staffchat")
		else if arg-1 is "ores":
			playerSettings(player, "oresalert")
		else if arg-1 is "echest" or "enderchest":
			open the player's ender chest to the player
		else if arg-1 is "clearchat" or "cc":
			playerSettings(player, "clearchat")
		else if arg-1 is "workbench" or "wb":
			open workbench to the player
		else if arg-1 is "mutechat" or "mc":
			playerSettings(player, "mutechat")
		else if arg-1 is "help":
			send "&8&m---------------------------------"
			send "&8[&b&lMM&8] &8(&7Put your mouse above the text"
			send "&8[&b&lMM&8] &7and click one to suggest.&8)"
			send formatted "<tooltip:&7CMD = &6/modmode or /mm><sgt:/mm>&8[&b&lMM&8] >> &aEnable&8/&cDisable &6Moderator Mode"
			send formatted "<tooltip:&7CMD = &d/modmode staffchat or /mm sc><sgt:/mm sc>&8[&b&lMM&8] >> &aEnable&8/&cDisable &dStaff Chat"
			send formatted "<tooltip:&7CMD = &e/modmode ores or /mm ores><sgt:/mm ores>&8[&b&lMM&8] >> &aEnable&8/&cDisable &eOres Alert"
			send formatted "<tooltip:&7CMD = &b/modmode enderchest or /mm echest><sgt:/mm echest>&8[&b&lMM&8] >> &bOpen your own ender chest"
			send formatted "<tooltip:&7CMD = &6/modmode workbench or /mm wb><sgt:/mm wb>&8[&b&lMM&8] >> &6Open workbench"
			send formatted "<tooltip:&7CMD = &d/modmode clearchat or /mm cc><sgt:/mm cc>&8[&b&lMM&8] >> &dClear Global Chat"
			send formatted "<tooltip:&7CMD = &e/modmode mutechat or /mm mc><sgt:/mm mc>&8[&b&lMM&8] >> &eMute Global Chat"
			send "&8&m---------------------------------"