File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
src/main/java/com/mcmoddev/orespawn Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .mcmoddev .orespawn .api .os3 ;
2+
3+ public interface DimensionList {
4+ boolean match ( int dimensionId );
5+ void create ( int [] whitelist , int [] blacklist );
6+ }
Original file line number Diff line number Diff line change 1+ package com .mcmoddev .orespawn .impl .os3 ;
2+
3+ import com .mcmoddev .orespawn .api .os3 .DimensionList ;
4+
5+ import java .util .Arrays ;
6+ import java .util .LinkedList ;
7+ import java .util .List ;
8+
9+ public class DimensionListImpl implements DimensionList {
10+ private List <Integer > whitelist ;
11+ private List <Integer > blacklist ;
12+
13+ DimensionListImpl () {
14+ this .whitelist = new LinkedList <> ();
15+ this .blacklist = new LinkedList <> ();
16+ }
17+
18+ @ Override
19+ public boolean match ( int dimensionId ) {
20+ return !whitelist .isEmpty () && !blacklist .contains ( dimensionId ) && whitelist .contains ( dimensionId );
21+
22+ }
23+
24+ @ Override
25+ public void create ( int [] whitelist , int [] blacklist ) {
26+ Arrays .stream (whitelist ).map ( Integer ::new ).forEach ( this .whitelist ::add );
27+ Arrays .stream (blacklist ).map ( Integer ::new ).forEach ( this .blacklist ::add );
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments