Minefun Smart Block Place 🧱

Hỗ trợ đặt block nhanh (giữ chuột để auto place)

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Minefun Smart Block Place 🧱
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Hỗ trợ đặt block nhanh (giữ chuột để auto place)
// @author       You
// @match        *://minefun.io/*
// @match        *://*.minefun.io/*
// @grant        none
// ==/UserScript==

(function(){

'use strict';

let on=false,scale=1,placing=false;

/* ===== BUTTON ===== */
const btn=document.createElement("div");
btn.innerHTML="🧱";
btn.style.position="fixed";
btn.style.top="150px";
btn.style.left="100px";
btn.style.width="60px";
btn.style.height="60px";
btn.style.background="#8b5a2b";
btn.style.borderRadius="12px";
btn.style.display="flex";
btn.style.alignItems="center";
btn.style.justifyContent="center";
btn.style.fontSize="30px";
btn.style.cursor="pointer";
btn.style.zIndex="999999";
btn.style.boxShadow="0 0 15px #000";

document.body.appendChild(btn);

/* ===== DRAG ===== */
let dragging=false,offsetX=0,offsetY=0;

btn.onmousedown=e=>{
dragging=true;
offsetX=e.offsetX;
offsetY=e.offsetY
};

document.onmouseup=()=>{
dragging=false;
placing=false;
};

document.onmousemove=e=>{
if(dragging){
btn.style.left=e.clientX-offsetX+"px";
btn.style.top=e.clientY-offsetY+"px"
}
};

/* ===== TOGGLE ===== */
btn.onclick=()=>{
on=!on;
btn.style.background=on?"#4CAF50":"#8b5a2b";
};

/* ===== AUTO PLACE (HOLD CLICK) ===== */
document.addEventListener("mousedown",e=>{
if(!on) return;
if(e.button!==0) return; // chuột trái

placing=true;

let interval=setInterval(()=>{
if(!placing) return clearInterval(interval);

/* giả lập click liên tục (đặt block nhanh hơn) */
document.dispatchEvent(new MouseEvent("mousedown",{bubbles:true}));
document.dispatchEvent(new MouseEvent("mouseup",{bubbles:true}));

},1); // tốc độ đặt block

});

document.addEventListener("mouseup",()=>{
placing=false;
});

/* ===== RESIZE +/- ===== */
document.addEventListener("keydown",e=>{
if(e.key==="+"){
scale+=0.1;
btn.style.transform="scale("+scale+")"
}
if(e.key==="-"&&scale>0.5){
scale-=0.1;
btn.style.transform="scale("+scale+")"
}
});

})();