001/* 002 * PlotSquared, a land and world management plugin for Minecraft. 003 * Copyright (C) IntellectualSites <https://intellectualsites.com> 004 * Copyright (C) IntellectualSites team and contributors 005 * 006 * This program is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <https://www.gnu.org/licenses/>. 018 */ 019package com.plotsquared.core.plot.world; 020 021import com.plotsquared.core.location.BlockLoc; 022import com.plotsquared.core.location.Location; 023import com.plotsquared.core.plot.Plot; 024import com.plotsquared.core.plot.PlotArea; 025import com.plotsquared.core.plot.PlotId; 026import com.plotsquared.core.plot.flag.PlotFlag; 027import com.sk89q.worldedit.math.BlockVector3; 028import com.sk89q.worldedit.regions.CuboidRegion; 029import org.checkerframework.checker.nullness.qual.NonNull; 030 031import java.util.Collection; 032import java.util.Collections; 033import java.util.HashSet; 034import java.util.Set; 035import java.util.UUID; 036import java.util.function.Consumer; 037 038public class SinglePlot extends Plot { 039 040 private final Set<CuboidRegion> regions = Collections.singleton( 041 new CuboidRegion( 042 BlockVector3.at(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE), 043 BlockVector3.at(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE) 044 )); 045 046 public SinglePlot(final @NonNull PlotArea area, final @NonNull PlotId id) { 047 super(area, id); 048 } 049 050 public SinglePlot( 051 PlotId id, UUID owner, HashSet<UUID> trusted, HashSet<UUID> members, 052 HashSet<UUID> denied, String alias, BlockLoc position, Collection<PlotFlag<?, ?>> flags, 053 PlotArea area, boolean[] merged, long timestamp, int temp 054 ) { 055 super(id, owner, trusted, members, denied, alias, position, flags, area, merged, timestamp, 056 temp 057 ); 058 } 059 060 @Override 061 public String getWorldName() { 062 return getId().toUnderscoreSeparatedString(); 063 } 064 065 @Override 066 public SinglePlotArea getArea() { 067 return (SinglePlotArea) super.getArea(); 068 } 069 070 @Override 071 public void getSide(Consumer<Location> result) { 072 getCenter(result); 073 } 074 075 @Override 076 public boolean isLoaded() { 077 getArea().loadWorld(getId()); 078 return super.isLoaded(); 079 } 080 081 @NonNull 082 @Override 083 public Set<CuboidRegion> getRegions() { 084 return regions; 085 } 086 087 // getCenter getSide getHome getDefaultHome getBiome 088}