Moved classes and packages to be in src > main > java

This commit is contained in:
Brian 2018-06-03 04:33:52 -06:00
parent 74bd2c52cc
commit 2ce7c4f0a7
23 changed files with 157 additions and 47 deletions

View File

@ -14,7 +14,6 @@ tasks.withType(JavaCompile) {
}
repositories {
maven { url "http://repo.maven.apache.org/maven2" }
}

View File

@ -2,8 +2,8 @@ package com.sekwah.advancedportals.core;
import com.sekwah.advancedportals.core.api.commands.SubCommand;
import com.sekwah.advancedportals.core.api.destination.Destination;
import com.sekwah.advancedportals.core.api.managers.DestinationManager;
import com.sekwah.advancedportals.core.api.managers.PortalManager;
import com.sekwah.advancedportals.core.repository.DestinationRepositoryImpl;
import com.sekwah.advancedportals.core.repository.PortalRepositoryImpl;
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.api.registry.TagRegistry;
import com.sekwah.advancedportals.core.api.registry.WarpEffectRegistry;
@ -37,8 +37,8 @@ public class AdvancedPortalsCore {
private CommandWithSubCommands portalCommand;
private CommandWithSubCommands destiCommand;
private PortalManager portalManager;
private DestinationManager destiManager;
private PortalRepositoryImpl portalRepositoryImpl;
private DestinationRepositoryImpl destiManager;
public static final String version = "1.0.0";
public static final String lastTranslationUpdate = "1.0.0";
@ -103,8 +103,8 @@ public class AdvancedPortalsCore {
private void onEnable() {
this.coreListeners = new CoreListeners(this);
this.portalManager = new PortalManager(this);
this.destiManager = new DestinationManager(this);
this.portalRepositoryImpl = new PortalRepositoryImpl(this);
this.destiManager = new DestinationRepositoryImpl(this);
this.warpEffectRegistry = new WarpEffectRegistry();
this.portalTagRegistry = new TagRegistry<>();
this.destiTagRegistry = new TagRegistry<>();
@ -117,7 +117,7 @@ public class AdvancedPortalsCore {
this.registerPortalCommand();
this.registerDestinationCommand();
this.portalManager.loadPortals();
this.portalRepositoryImpl.loadPortals();
this.destiManager.loadDestinations();
@ -196,11 +196,11 @@ public class AdvancedPortalsCore {
return instance.coreListeners;
}
public static PortalManager getPortalManager() {
return instance.portalManager;
public static PortalRepositoryImpl getPortalManager() {
return instance.portalRepositoryImpl;
}
public static DestinationManager getDestinationManager() {
public static DestinationRepositoryImpl getDestinationManager() {
return instance.destiManager;
}

View File

@ -1,7 +1,7 @@
package com.sekwah.advancedportals.core;
import com.sekwah.advancedportals.core.data.PlayerLocation;
import com.sekwah.advancedportals.core.data.PortalLocation;
import com.sekwah.advancedportals.core.entities.PlayerLocation;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import com.sekwah.advancedportals.coreconnector.container.WorldContainer;

View File

@ -2,12 +2,12 @@ package com.sekwah.advancedportals.core.api.destination;
import com.google.gson.annotations.SerializedName;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.portal.DataTag;
import com.sekwah.advancedportals.core.entities.DataTag;
import com.sekwah.advancedportals.core.api.portal.PortalException;
import com.sekwah.advancedportals.core.api.registry.TagRegistry;
import com.sekwah.advancedportals.core.api.warphandler.ActivationData;
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
import com.sekwah.advancedportals.core.data.PlayerLocation;
import com.sekwah.advancedportals.core.entities.PlayerLocation;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import java.util.ArrayList;

View File

@ -1,7 +1,7 @@
package com.sekwah.advancedportals.core.api.effect;
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.data.PortalLocation;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
/**

View File

@ -1,7 +1,7 @@
package com.sekwah.advancedportals.core.api.effect;
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.data.PortalLocation;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
/**

View File

@ -5,7 +5,8 @@ import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.registry.TagRegistry;
import com.sekwah.advancedportals.core.api.warphandler.ActivationData;
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
import com.sekwah.advancedportals.core.data.PortalLocation;
import com.sekwah.advancedportals.core.entities.DataTag;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import java.util.ArrayList;

View File

@ -1,7 +1,7 @@
package com.sekwah.advancedportals.core.api.warphandler;
import com.sekwah.advancedportals.core.data.PlayerLocation;
import com.sekwah.advancedportals.core.entities.PlayerLocation;
/**
* Created by on 30/07/2016.

View File

@ -1,7 +1,6 @@
package com.sekwah.advancedportals.core.commands.subcommands;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.portal.DataTag;
import com.sekwah.advancedportals.core.entities.DataTag;
import java.util.ArrayList;

View File

@ -3,7 +3,7 @@ package com.sekwah.advancedportals.core.commands.subcommands.desti;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.commands.SubCommand;
import com.sekwah.advancedportals.core.api.destination.Destination;
import com.sekwah.advancedportals.core.api.portal.DataTag;
import com.sekwah.advancedportals.core.entities.DataTag;
import com.sekwah.advancedportals.core.api.portal.PortalException;
import com.sekwah.advancedportals.core.commands.subcommands.CreateSubCommand;
import com.sekwah.advancedportals.core.util.Lang;

View File

@ -3,7 +3,7 @@ package com.sekwah.advancedportals.core.commands.subcommands.portal;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.commands.SubCommand;
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.api.portal.DataTag;
import com.sekwah.advancedportals.core.entities.DataTag;
import com.sekwah.advancedportals.core.api.portal.PortalException;
import com.sekwah.advancedportals.core.commands.subcommands.CreateSubCommand;
import com.sekwah.advancedportals.core.util.Lang;

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.core.api.portal;
package com.sekwah.advancedportals.core.entities;
public class DataTag {

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.core.data;
package com.sekwah.advancedportals.core.entities;
import com.google.gson.annotations.SerializedName;

View File

@ -1,4 +1,4 @@
package com.sekwah.advancedportals.core.data;
package com.sekwah.advancedportals.core.entities;
import com.google.gson.annotations.SerializedName;

View File

@ -0,0 +1,6 @@
package com.sekwah.advancedportals.core.enums;
public enum EnumHandSelection {
LEFTHAND,
RIGHTHAND
}

View File

@ -0,0 +1,12 @@
package com.sekwah.advancedportals.core.repository;
import com.google.common.collect.ImmutableMap;
import com.sekwah.advancedportals.core.api.destination.Destination;
public interface DestinationRepository {
void create(String name, Destination destination);
void delete(String name);
ImmutableMap<String, Destination> getDestinations();
}

View File

@ -1,33 +1,41 @@
package com.sekwah.advancedportals.core.api.managers;
package com.sekwah.advancedportals.core.repository;
import com.google.common.collect.ImmutableMap;
import com.google.gson.reflect.TypeToken;
import com.google.inject.Singleton;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.destination.Destination;
import com.sekwah.advancedportals.core.api.portal.DataTag;
import com.sekwah.advancedportals.core.entities.DataTag;
import com.sekwah.advancedportals.core.api.portal.PortalException;
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
import com.sekwah.advancedportals.core.data.PlayerLocation;
import com.sekwah.advancedportals.core.entities.PlayerLocation;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @author sekwah41
*/
public class DestinationManager {
@Singleton
public class DestinationRepositoryImpl implements DestinationRepository {
private Map<String, Destination> destiHashMap = new HashMap<>();
private final AdvancedPortalsCore portalsCore;
/**
* Contains all the data for the destinations
*/
private HashMap<String, Destination> destiHashMap = new HashMap<>();
public DestinationManager(AdvancedPortalsCore portalsCore) {
this.portalsCore = portalsCore;
@Override
public void create(String name, Destination destination) {
destiHashMap.put(name, destination);
}
@Override
public void delete(String name) {
destiHashMap.remove(name);
}
@Override
public ImmutableMap<String, Destination> getDestinations() {
return ImmutableMap.copyOf(destiHashMap);
}
public Destination createDesti(String name, PlayerContainer player, PlayerLocation playerLocation, ArrayList<DataTag> tags) throws PortalException {
if(name == null || name.equals("")) {
throw new PortalException("desti.error.noname");

View File

@ -3,11 +3,11 @@ package com.sekwah.advancedportals.core.api.managers;
import com.google.gson.reflect.TypeToken;
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
import com.sekwah.advancedportals.core.api.portal.AdvancedPortal;
import com.sekwah.advancedportals.core.api.portal.DataTag;
import com.sekwah.advancedportals.core.entities.DataTag;
import com.sekwah.advancedportals.core.api.portal.PortalException;
import com.sekwah.advancedportals.core.api.warphandler.TagHandler;
import com.sekwah.advancedportals.core.data.PlayerLocation;
import com.sekwah.advancedportals.core.data.PortalLocation;
import com.sekwah.advancedportals.core.entities.PlayerLocation;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;

View File

@ -0,0 +1,18 @@
package com.sekwah.advancedportals.core.repository;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.core.enums.EnumHandSelection;
import java.util.UUID;
public interface SelectionRepository {
void addSelectedPortal(UUID selectedPlayer, String portal);
void removeSelectedPortal(UUID uuid);
void addSelectedHand(UUID uuid, EnumHandSelection enumHandSelection, PortalLocation portalLocation);
void removeSelectedHand(UUID uuid, EnumHandSelection enumHandSelection);
void removeAllSelectedHand(UUID uuid);
}

View File

@ -0,0 +1,53 @@
package com.sekwah.advancedportals.core.repository;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheBuilderSpec;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Table;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import com.sekwah.advancedportals.core.enums.EnumHandSelection;
import com.sun.media.jfxmedia.events.PlayerStateEvent;
import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@Singleton
public class SelectionRepositoryImpl implements SelectionRepository {
Cache<UUID, String> selectedPortal = CacheBuilder.newBuilder()
.concurrencyLevel(4)
.expireAfterAccess(30, TimeUnit.DAYS)
.build();
Table<UUID, EnumHandSelection, PortalLocation> selectedHand = HashBasedTable.create();
@Override
public void addSelectedPortal(UUID selectedPlayer, String portal) {
selectedPortal.put(selectedPlayer, portal);
}
@Override
public void removeSelectedPortal(UUID uuid) {
selectedPortal.invalidate(uuid);
}
@Override
public void addSelectedHand(UUID uuid, EnumHandSelection enumHandSelection, PortalLocation portalLocation) {
selectedHand.put(uuid, enumHandSelection, portalLocation);
}
@Override
public void removeSelectedHand(UUID uuid, EnumHandSelection enumHandSelection) {
selectedHand.remove(uuid, enumHandSelection);
}
@Override
public void removeAllSelectedHand(UUID uuid) {
selectedHand.remove(uuid, EnumHandSelection.LEFTHAND);
selectedHand.remove(uuid, EnumHandSelection.RIGHTHAND);
}
}

View File

@ -1,7 +1,7 @@
package com.sekwah.advancedportals.coreconnector.container;
import com.sekwah.advancedportals.core.data.PlayerLocation;
import com.sekwah.advancedportals.core.data.PortalLocation;
import com.sekwah.advancedportals.core.entities.PlayerLocation;
import com.sekwah.advancedportals.core.entities.PortalLocation;
import java.util.UUID;

View File

@ -1,6 +1,6 @@
package com.sekwah.advancedportals.coreconnector.container;
import com.sekwah.advancedportals.core.data.PortalLocation;
import com.sekwah.advancedportals.core.entities.PortalLocation;
public class WorldContainer {

View File

@ -0,0 +1,14 @@
config:
useOnlySpecialize: true
selectorMaterial: "IRON_AXE"
portalProtection: true
portalProtectionRadius: 5
defaultTriggerBlock: "PORTAL"
stopWaterFlow: true
portalCooldown: 5
warpParticles: "ENDER"
warpSound: "ENDER"
selectionBlock_BELOW_1_13: "STAINED_GLASS"
selectionBlock: "RED_STAINED_GLASS"
translationFile: "en_DB"
selectionSubID_BELOW_1_13: 14;