WorldGuard Region Events (Updated) icon

WorldGuard Region Events (Updated) -----

WorldGuard Region Events Updated API



Added SimpleWorldGuardAPI
Code (Text):
package de.netzkronehd.WGRegionEvents;

import java.util.Map;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;

import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;

import de.netzkronehd.WGRegionEvents.api.SimpleWorldGuardAPI;

public class Example extends JavaPlugin {
   
    private static Example instance;
    private SimpleWorldGuardAPI simpleWorldGuardApi;
   
   
    @Override
    public void onEnable() {
        instance = this;
       
        simpleWorldGuardApi = new SimpleWorldGuardAPI();  
       
       
//        Getting a region by id (unperformant)
        ProtectedRegion spawn = simpleWorldGuardApi.getRegion("spawn");
        if (spawn != null) {
            spawn.getOwners().getUniqueIds();
        }
       
//        Getting a region by id and world
        ProtectedRegion pvp = simpleWorldGuardApi.getRegion("pvp", Bukkit.getWorld("world"));
        if (pvp != null) {
            pvp.getFlags();
        }
       
//        Getting all regions (unperformant)
        Map<String, ProtectedRegion> allRegions = simpleWorldGuardApi.getRegions();
        ProtectedRegion spawn2 = allRegions.get("spawn2");
        if (spawn2 != null) {
            spawn2.getType();
        }
       
//        Getting all regions on a Location
        ApplicableRegionSet localRegions = simpleWorldGuardApi.getRegions(new Location(Bukkit.getWorld("world"), 102, 147, 2002));
        for(ProtectedRegion rg : localRegions) {
            if(rg.getId().equalsIgnoreCase("spawn")) {
               
            }
        }
       
//        Getting all regions in a World
        Map<String, ProtectedRegion> worldRegions = simpleWorldGuardApi.getRegions(Bukkit.getWorld("world"));
        for(ProtectedRegion rg : worldRegions.values()) {
            rg.getId();
        }
       
    }
   
   
    public SimpleWorldGuardAPI getSimpleWorldGuardApi() {
        return simpleWorldGuardApi;
    }
   
    public static Example getInstance() {
        return instance;
    }
}
 
----------, Dec 19, 2020
Resource Information
Author:
----------
Total Downloads: 5,061
First Release: Oct 10, 2018
Last Update: Nov 30, 2023
Category: ---------------
All-Time Rating:
9 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings