Помогите WorldGuard как поставить определенный блок, обойдя приват?

Статус
Закрыто для дальнейших ответов.

Lisenochek

Активный участник
Пользователь
Баллы
76
Имя в Minecraft
Lisenochek
Всем привет! Сделал я взрывчатку, но вот незадача! Ее не поставить там, где есть чужой приват. Мне нужно это обойти, но все мои попытки были тщетными. Помогите мне пожалуйста, как поставить блок в чужом регионе?
 
Редактируй ВГ - поставь проверку на блок в методе, который запрещает его установку в привате.
 
ну можно сделать 2 евента. Один EventPriority.LOWEST(1) второй .HIGHEST(2), ignoreCancelled = false
в (1) отменяешь евент (setCancelled(true)), тогда вг проигнорит этот блок и не отправит сообщение.
в (2) setCancelled(false) тут мы отменяем отмену евента.
 
ну можно сделать 2 евента. Один EventPriority.LOWEST(1) второй .HIGHEST(2), ignoreCancelled = false
в (1) отменяешь евент (setCancelled(true)), тогда вг проигнорит этот блок и не отправит сообщение.
в (2) setCancelled(false) тут мы отменяем отмену евента.
Так ты имеешь в виду?
JavaScript:
    @EventHandler(priority = EventPriority.LOWEST)
    public void adsd(BlockPlaceEvent e) {
        e.setCancelled(true);
    }

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void useC4InInRightHand(BlockPlaceEvent e) {

        Player p = e.getPlayer();

        if (!p.getInventory().getItemInMainHand().hasItemMeta()) return;
        if (!p.getInventory().getItemInMainHand().getItemMeta().hasDisplayName()) return;
        if (!p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(ListItems.c4.getItemMeta().getDisplayName())) return;

        e.setCancelled(false);
        setEntityTNT(p, e.getBlockPlaced().getLocation());
        e.getBlockPlaced().setType(Material.AIR);
        p.sendMessage(C.getPrefix() + C.c("&aЯ активировал взрывчатку! У меня есть 10 секунд!"));
    }
 
Последнее редактирование:
Ну... Примерно все, проблема осталась открытой, щас отдебажу...
Что именно не рработает?

Отдебажил, тыкаю взрывчаткой - месседж, что ее ставить запрещено, ставлю другие блоки, отзывается метод asd
 
хз.
Сначало отрабатывается LOWEST потом LOW потом NORMAL, HIGH, HIGHEST
вг работает на нормале. Тоесть если евент до нормала был отменён, то вг не будет его обрабатывать.
тоесть в Lowest мы отменяем евент, если это был наш предмет.
В highest мы обрабатываем его.


ты тут на false изменил то?
 
хз.
Сначало отрабатывается LOWEST потом LOW потом NORMAL, HIGH, HIGHEST
вг работает на нормале. Тоесть если евент до нормала был отменён, то вг не будет его обрабатывать.
тоесть в Lowest мы отменяем евент, если это был наш предмет.
В highest мы обрабатываем его.



ты тут на false изменил то?
Я понял в чем трабл, я не могу поставить динамит в любом случае, но почему? Я же его не отключал. Может быть я не вижу этот пункт, но все же, вдруг:
Код:
#
# WorldGuard's main configuration file
#
# This is the global configuration file. Anything placed into here will
# be applied to all worlds. However, each world has its own configuration
# file to allow you to replace most settings in here for that world only.
#
# About editing this file:
# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If
#   you use an editor like Notepad++ (recommended for Windows users), you
#   must configure it to "replace tabs with spaces." In Notepad++, this can
#   be changed in Settings > Preferences > Language Menu.
# - Don't get rid of the indents. They are indented so some entries are
#   in categories (like "enforce-single-session" is in the "protection"
#   category.
# - If you want to check the format of this file before putting it
#   into WorldGuard, paste it into http://yaml-online-parser.appspot.com/
#   and see if it gives "ERROR:".
# - Lines starting with # are comments and so they are ignored.
#

regions:
    uuid-migration:
        perform-on-next-start: false
        keep-names-that-lack-uuids: true
    use-creature-spawn-event: true
    sql:
        use: false
        dsn: jdbc:mysql://localhost/worldguard
        username: worldguard
        password: worldguard
        table-prefix: ''
    enable: true
    invincibility-removes-mobs: false
    nether-portal-protection: false
    fake-player-build-override: true
    explosion-flags-block-entity-damage: true
    high-frequency-flags: false
    protect-against-liquid-flow: false
    wand: 334
    max-claim-volume: 30000
    claim-only-inside-existing-regions: false
    location-flags-only-inside-regions: false
    max-region-count-per-player:
        default: 7
auto-invincible: false
auto-invincible-group: false
auto-no-drowning-group: false
use-player-move-event: true
use-player-teleports: true
security:
    deop-everyone-on-join: false
    block-in-game-op-command: false
host-keys: {}
summary-on-start: true
op-permissions: true
build-permission-nodes:
    enable: false
    deny-message: '&eSorry, but you are not permitted to do that here.'
event-handling:
    block-entity-spawns-with-untraceable-cause: false
    interaction-whitelist: []
    emit-block-use-at-feet: []
protection:
    item-durability: true
    remove-infinite-stacks: false
    disable-xp-orb-drops: false
    disable-obsidian-generators: false
gameplay:
    block-potions: []
    block-potions-overly-reliably: false
simulation:
    sponge:
        enable: false
        radius: 3
        redstone: false
default:
    pumpkin-scuba: false
    disable-health-regain: false
physics:
    no-physics-gravel: false
    no-physics-sand: false
    vine-like-rope-ladders: false
    allow-portal-anywhere: false
    disable-water-damage-blocks: []
ignition:
    block-tnt: false
    block-tnt-block-damage: false
    block-lighter: false
fire:
    disable-lava-fire-spread: true
    disable-all-fire-spread: false
    disable-fire-spread-blocks: []
    lava-spread-blocks: []
mobs:
    block-creeper-explosions: false
    block-creeper-block-damage: false
    block-wither-explosions: false
    block-wither-block-damage: false
    block-wither-skull-explosions: false
    block-wither-skull-block-damage: false
    block-enderdragon-block-damage: false
    block-enderdragon-portal-creation: false
    block-fireball-explosions: false
    block-fireball-block-damage: false
    anti-wolf-dumbness: false
    allow-tamed-spawns: true
    disable-enderman-griefing: false
    disable-snowman-trails: false
    block-painting-destroy: false
    block-item-frame-destroy: false
    block-plugin-spawning: true
    block-above-ground-slimes: false
    block-other-explosions: false
    block-zombie-door-destruction: false
    block-creature-spawn: []
player-damage:
    disable-fall-damage: false
    disable-lava-damage: false
    disable-fire-damage: false
    disable-lightning-damage: false
    disable-drowning-damage: false
    disable-suffocation-damage: false
    disable-contact-damage: false
    teleport-on-suffocation: false
    disable-void-damage: false
    teleport-on-void-falling: false
    disable-explosion-damage: false
    disable-mob-damage: false
    disable-death-messages: false
chest-protection:
    enable: false
    disable-off-check: false
crops:
    disable-creature-trampling: false
    disable-player-trampling: false
weather:
    prevent-lightning-strike-blocks: []
    disable-lightning-strike-fire: false
    disable-thunderstorm: false
    disable-weather: false
    disable-pig-zombification: false
    disable-powered-creepers: false
    always-raining: false
    always-thundering: false
dynamics:
    disable-mushroom-spread: false
    disable-ice-melting: false
    disable-snow-melting: false
    disable-snow-formation: false
    disable-ice-formation: false
    disable-leaf-decay: false
    disable-grass-growth: false
    disable-mycelium-spread: false
    disable-vine-growth: false
    disable-soil-dehydration: false
    snow-fall-blocks: []
blacklist:
    use-as-whitelist: false
    logging:
        console:
            enable: true
        database:
            enable: false
            dsn: jdbc:mysql://localhost:3306/minecraft
            user: root
            pass: ''
            table: blacklist_events
        file:
            enable: false
            path: worldguard/logs/%Y-%m-%d.log
            open-files: 10
 
Последнее редактирование:
может быть в blacklist от wg?
blacklist состоит из образцов и примеров:

Код:
#
# WorldGuard blacklist
#
# The blacklist lets you block actions, blocks, and items from being used.
# You choose a set of "items to affect" and a list of "actions to perform."
#
###############################################################################
#
# Example to block some ore mining and placement:
# [coalore,goldore,ironore]
# on-break=deny,log,kick
# on-place=deny,tell
#
# Events that you can detect:
# - on-break (when a block of this type is about to be broken)
# - on-destroy-with (the item/block held by the user while destroying)
# - on-place (a block is being placed)
# - on-use (an item like flint and steel or a bucket is being used)
# - on-interact (when a block in used (doors, chests, etc.))
# - on-drop (an item is being dropped from the player's inventory)
# - on-acquire (an item enters a player's inventory via some method)
# - on-dispense (a dispenser is about to dispense an item)
#
# Actions (for events):
# - deny (deny completely, used blacklist mode)
# - allow (used in whitelist mode)
# - notify (notify admins with the 'worldguard.notify' permission)
# - log (log to console/file/database)
# - tell (tell a player that that's not allowed)
# - kick (kick player)
# - ban (ban player)
#
# Options:
# - ignore-groups (comma-separated list of groups to not affect)
# - ignore-perms (comma-separated list of permissions to not affect - make up
#   your very own permissions!)
# - comment (message for yourself that is printed with 'log' and 'notify')
# - message (optional message to show the user instead; %s is the item name)
#
###############################################################################
#
# For more information, see:
# http://wiki.sk89q.com/wiki/WorldGuard/Blacklist
#
###############################################################################
#
# Some examples follow.
# REMEMBER: If a line has # in front, it will be ignored.
#

# Deny lava buckets
#[lavabucket]
#ignore-perms=my.own.madeup.permission
#ignore-groups=admins,mods
#on-use=deny,tell

# Deny some ore
#[coalore,goldore,ironore]
#ignore-groups=admins,mods
#on-break=notify,deny,log

# Some funky data value tests
#[wood:0;>=2]
#ignore-groups=admins,mods
#on-break=notify,deny,log
 
blacklist состоит из образцов и примеров:

Код:
#
# WorldGuard blacklist
#
# The blacklist lets you block actions, blocks, and items from being used.
# You choose a set of "items to affect" and a list of "actions to perform."
#
###############################################################################
#
# Example to block some ore mining and placement:
# [coalore,goldore,ironore]
# on-break=deny,log,kick
# on-place=deny,tell
#
# Events that you can detect:
# - on-break (when a block of this type is about to be broken)
# - on-destroy-with (the item/block held by the user while destroying)
# - on-place (a block is being placed)
# - on-use (an item like flint and steel or a bucket is being used)
# - on-interact (when a block in used (doors, chests, etc.))
# - on-drop (an item is being dropped from the player's inventory)
# - on-acquire (an item enters a player's inventory via some method)
# - on-dispense (a dispenser is about to dispense an item)
#
# Actions (for events):
# - deny (deny completely, used blacklist mode)
# - allow (used in whitelist mode)
# - notify (notify admins with the 'worldguard.notify' permission)
# - log (log to console/file/database)
# - tell (tell a player that that's not allowed)
# - kick (kick player)
# - ban (ban player)
#
# Options:
# - ignore-groups (comma-separated list of groups to not affect)
# - ignore-perms (comma-separated list of permissions to not affect - make up
#   your very own permissions!)
# - comment (message for yourself that is printed with 'log' and 'notify')
# - message (optional message to show the user instead; %s is the item name)
#
###############################################################################
#
# For more information, see:
# http://wiki.sk89q.com/wiki/WorldGuard/Blacklist
#
###############################################################################
#
# Some examples follow.
# REMEMBER: If a line has # in front, it will be ignored.
#

# Deny lava buckets
#[lavabucket]
#ignore-perms=my.own.madeup.permission
#ignore-groups=admins,mods
#on-use=deny,tell

# Deny some ore
#[coalore,goldore,ironore]
#ignore-groups=admins,mods
#on-break=notify,deny,log

# Some funky data value tests
#[wood:0;>=2]
#ignore-groups=admins,mods
#on-break=notify,deny,log
В таком случае есть подозрения на другие плагины.

А вообще тут где то @alexandrage говорил (правда про хаки это было)
Есть еще вот такие мелкие хитрости типо.
Java:
@EventHandler(priority = EventPriority.MONITOR)
public void on(PlayerInteractEvent e) {
    e.setCancelled(false);
}
Так мы отменяем отмененный ивент и можем грифирить. EventPriority.MONITOR используется самым последним, что дает нам гарантию отменить отмену ивента во всех плагинах.
 
Мои глаза опухли от ваших постов.

Java:
    @EventHandler(priority = EventPriority.HIGHEST)
    public void adsd(BlockPlaceEvent e) {
        if(checkTNT(e.getBlockPlaced())) {
            e.setCancelled(false);
        }
    }
 
    @EventHandler(priority = EventPriority.HIGHEST)
    public void adsd(PlayerInteractEvent e) {
        if(checkTNT(e.getClickedBlock())) {
            e.setCancelled(false);
        }
    }

Lisenochek Говнокодерства тебе не занимать, ты там от своего кода еще не давишься? УтебяТамВсеВОднойКаше.
 
Так ты имеешь в виду?
JavaScript:
    @EventHandler(priority = EventPriority.LOWEST)
    public void adsd(BlockPlaceEvent e) {
        e.setCancelled(true);
    }

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void useC4InInRightHand(BlockPlaceEvent e) {

        Player p = e.getPlayer();

        if (!p.getInventory().getItemInMainHand().hasItemMeta()) return;
        if (!p.getInventory().getItemInMainHand().getItemMeta().hasDisplayName()) return;
        if (!p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(ListItems.c4.getItemMeta().getDisplayName())) return;

        e.setCancelled(false);
        setEntityTNT(p, e.getBlockPlaced().getLocation());
        e.getBlockPlaced().setType(Material.AIR);
        p.sendMessage(C.getPrefix() + C.c("&aЯ активировал взрывчатку! У меня есть 10 секунд!"));
    }

ахха, я почитал код (своевременно) и тут же увидел ошибку.

Первый ивент имеет низкий приоритет, следовательно выполнится код позже чем у того ивента который снизу.

В итоге получается что в нижнем ивенте ты делаешь все как надо, а потом в ивенте который "выполнится" позже, спокойненько setcancelled(true) абсолютно не зависимо от ситуации.

(приоритеты наооборот поставь, чудо)

про игнор cancelled Ниче не знаю, пока что по симптомам он не помогает
 
ахха, я почитал код (своевременно) и тут же увидел ошибку.

Первый ивент имеет низкий приоритет, следовательно выполнится код позже чем у того ивента который снизу.

В итоге получается что в нижнем ивенте ты делаешь все как надо, а потом в ивенте который "выполнится" позже, спокойненько setcancelled(true) абсолютно не зависимо от ситуации.

(приоритеты наооборот поставь, чудо)

про игнор cancelled Ниче не знаю, пока что по симптомам он не помогает
Тут вообще полный бред, не смотри даже.
 
Статус
Закрыто для дальнейших ответов.
Назад
Верх