59 lines
1.4 KiB
Markdown
59 lines
1.4 KiB
Markdown
# Grim2.js — handler() (satır 117)
|
||
|
||
[← Grim2.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
function handler(c) {
|
||
var p = getPlayer(c);
|
||
if (!p || !p.isPlayer()) return;
|
||
|
||
if (lower(p.getName()) !== lower(OWNER)) {
|
||
p.closeUI();
|
||
return;
|
||
}
|
||
|
||
var ctx = p.getUIContext();
|
||
if (!ctx) return;
|
||
|
||
var last = String(ctx.getLast());
|
||
var data = ctx.getData();
|
||
|
||
if (last === "close") {
|
||
p.closeUI();
|
||
return;
|
||
}
|
||
|
||
if (last === "spread") {
|
||
var blockId = trim(data.getString("block"));
|
||
var meta = trim(data.getString("meta"));
|
||
if (blockId.length === 0) {
|
||
p.send("\u00a7c[Acil] Block id gir. Ornek: minecraft:stone");
|
||
openMenu(c, p);
|
||
return;
|
||
}
|
||
if (meta.length === 0) meta = "0";
|
||
|
||
p.getStates().setString("acil_last_block", blockId);
|
||
p.getStates().setString("acil_last_meta", meta);
|
||
startFromText(c, p, blockId + " " + meta);
|
||
openMenu(c, p);
|
||
return;
|
||
}
|
||
|
||
if (last === "pull") {
|
||
pullBackNow(c, p);
|
||
openMenu(c, p);
|
||
return;
|
||
}
|
||
|
||
if (last === "reset") {
|
||
mappet.set(STATE_KEY, "0");
|
||
mappet.set(PHASE_KEY, "idle");
|
||
mappet.set(PULL_KEY, "0");
|
||
p.send("\u00a7a[Acil] Sistem durduruldu.");
|
||
openMenu(c, p);
|
||
return;
|
||
}
|
||
}
|
||
```
|