Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Update 2.1.14.1
Browse files Browse the repository at this point in the history
Merge development into master
  • Loading branch information
byRoadrunner authored Dec 11, 2018
2 parents aba1dea + 163dbe1 commit 94be7cd
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 84 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pipeline {
}
stage('Version') {
steps {
sh 'mvn versions:set -DnewVersion=2.1.14'
sh 'mvn versions:set -DnewVersion=2.1.14.1'
}
}
stage('Compile') {
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,32 @@ Use of KVM virtualization or dedicated servers is recommended.

### Developer
If you would like to contribute to this repository, feel free to fork the repo and then create a pull request to our current dev branch.

Maven:
```xml

<repositories>
<repository>
<id>cloudnet-repo</id>
<url>https://cloudnetservice.eu/repositories</url>
</repository>
</repositories>

<dependencies>
<!-- Spigot/BungeeCord -->
<dependency>
<groupId>de.dytanic.cloudnet</groupId>
<artifactId>cloudnet-api-bridge</artifactId>
<version>2.1.14</version>
<scope>provided</scope>
</dependency>
<!-- CloudNet Core -->
<dependency>
<groupId>de.dytanic.cloudnet</groupId>
<artifactId>cloudnet-core</artifactId>
<version>2.1.14</version>
<scope>provided</scope>
</dependency>
</dependencies>

```
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import de.dytanic.cloudnet.lib.player.permission.*;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;
import java.util.*;
import java.util.concurrent.TimeUnit;

@SuppressWarnings({"unused", "WeakerAccess"})
Expand Down Expand Up @@ -175,12 +172,10 @@ public static String getGroupName(UUID uuid)
*/
public static String getGroupPrefix(String groupName)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
return permissionGroup.getPrefix();
}
return permissionPool.getGroups().get(groupName).getPrefix();

return null;
}

Expand All @@ -195,12 +190,10 @@ public static String getGroupPrefix(String groupName)
*/
public static String getGroupSuffix(String groupName)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
return permissionGroup.getSuffix();
}
return permissionPool.getGroups().get(groupName).getSuffix();

return null;
}

Expand All @@ -226,12 +219,10 @@ public static boolean isInGroup(String groupName, OfflinePlayer offlinePlayer)
*/
public static String getGroupDisplay(String groupName)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
return permissionGroup.getDisplay();
}
return permissionPool.getGroups().get(groupName).getDisplay();

return null;
}

Expand All @@ -245,12 +236,10 @@ public static String getGroupDisplay(String groupName)
*/
public static Collection<String> getImplementedGroups(String groupName)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
return Collections.unmodifiableCollection(permissionGroup.getImplementGroups());
}
return Collections.unmodifiableCollection(permissionPool.getGroups().get(groupName).getImplementGroups());

return null;
}

Expand All @@ -275,12 +264,10 @@ public static int getJoinPower(OfflinePlayer player)
*/
public static Integer getGroupJoinPower(String groupName)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
return permissionGroup.getJoinPower();
}
return permissionPool.getGroups().get(groupName).getJoinPower();

return null;
}

Expand Down Expand Up @@ -347,7 +334,7 @@ public static void removePlayerPermission(OfflinePlayer offlinePlayer, String pe
*/
public static void addPermission(String permissionGroupName, String permission)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(permissionGroupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(permissionGroupName);
Expand All @@ -365,7 +352,7 @@ public static void addPermission(String permissionGroupName, String permission)
*/
public static void removePermission(String permissionGroupName, String permission)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(permissionGroupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(permissionGroupName);
Expand All @@ -383,9 +370,9 @@ public static void removePermission(String permissionGroupName, String permissio
* @param permission the permission to add
* @param serverGroup the server group to restrict the permission to
*/
public static void addServergroupPermission(String permissionGroupName, String permission, String serverGroup)
public static void addServerGroupPermission(String permissionGroupName, String permission, String serverGroup)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(permissionGroupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(permissionGroupName);
Expand All @@ -409,18 +396,15 @@ public static void addServergroupPermission(String permissionGroupName, String p
*/
public static void removeServerGroupPermission(String permissionGroupName, String permission, String serverGroup)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(permissionGroupName))
{
PermissionGroup permissionGroup = CloudAPI.getInstance().getPermissionGroup(permissionGroupName);
if (permissionGroup == null)
{
return;
}
if (permissionGroup == null) return;

if (!permissionGroup.getServerGroupPermissions().containsKey(permission))
{
permissionGroup.getServerGroupPermissions().put(permission, new ArrayList<>());
}

permissionGroup.getServerGroupPermissions().get(serverGroup).remove(permission.replaceFirst("-", ""));
updatePermissionGroup(permissionGroup);
}
Expand All @@ -436,7 +420,7 @@ public static void removeServerGroupPermission(String permissionGroupName, Strin
*/
public static void setPlayerGroup(OfflinePlayer offlinePlayer, String groupName, long time)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
offlinePlayer.getPermissionEntity().getGroups().clear();
Expand All @@ -456,7 +440,7 @@ public static void setPlayerGroup(OfflinePlayer offlinePlayer, String groupName,
*/
public static void addPlayerGroup(OfflinePlayer player, String groupName, long time)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
player.getPermissionEntity().getGroups().add(new GroupEntityData(groupName,
Expand All @@ -474,15 +458,16 @@ public static void addPlayerGroup(OfflinePlayer player, String groupName, long t
*/
public static void removePlayerGroup(String groupName, OfflinePlayer offlinePlayer)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
offlinePlayer.getPermissionEntity().getGroups().stream()
.filter(e -> e.getGroup().equals(groupName))
.forEach(e -> offlinePlayer.getPermissionEntity().getGroups().remove(e));
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final List<GroupEntityData> groupEntityData = new ArrayList<>(offlinePlayer.getPermissionEntity().getGroups());
groupEntityData.forEach(group -> {
if (group.getGroup().equals(groupName))
offlinePlayer.getPermissionEntity().getGroups().remove(group);
});

if (offlinePlayer.getPermissionEntity().getGroups().size() == 0)
{
offlinePlayer.getPermissionEntity().getGroups().add(new GroupEntityData(permissionPool.getDefaultGroup().getName(), 0));
}

updatePlayer(offlinePlayer);
}

Expand Down Expand Up @@ -527,11 +512,10 @@ public static Collection<PermissionGroup> getGroups()
*/
public static PermissionGroup getPermissionGroup(String groupName)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
return permissionPool.getGroups().get(groupName);
}

return null;
}

Expand All @@ -543,10 +527,10 @@ public static PermissionGroup getPermissionGroup(String groupName)
*/
public static void setDisplay(String groupName, String display)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
final PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
permissionGroup.setDisplay(display);
updatePermissionGroup(permissionGroup);
}
Expand All @@ -560,10 +544,10 @@ public static void setDisplay(String groupName, String display)
*/
public static void setPrefix(String groupName, String prefix)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
final PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
permissionGroup.setPrefix(prefix);
updatePermissionGroup(permissionGroup);
}
Expand All @@ -577,10 +561,10 @@ public static void setPrefix(String groupName, String prefix)
*/
public static void setSuffix(String groupName, String suffix)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
final PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
permissionGroup.setSuffix(suffix);
updatePermissionGroup(permissionGroup);
}
Expand All @@ -593,14 +577,14 @@ public static void setSuffix(String groupName, String suffix)
*/
public static void setDefaultGroup(String groupName)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
PermissionGroup olddefault = permissionPool.getDefaultGroup();
olddefault.setDefaultGroup(false);
final PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
final PermissionGroup old = permissionPool.getDefaultGroup();
old.setDefaultGroup(false);
permissionGroup.setDefaultGroup(true);
updatePermissionGroup(olddefault);
updatePermissionGroup(old);
updatePermissionGroup(permissionGroup);
}
}
Expand All @@ -613,10 +597,10 @@ public static void setDefaultGroup(String groupName)
*/
public static void setJoinPower(String groupName, int joinPower)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
final PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
permissionGroup.setJoinPower(joinPower);
updatePermissionGroup(permissionGroup);
}
Expand All @@ -630,10 +614,10 @@ public static void setJoinPower(String groupName, int joinPower)
*/
public static void setTagID(String groupName, int tagId)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (permissionPool.getGroups().containsKey(groupName))
{
PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
final PermissionGroup permissionGroup = permissionPool.getGroups().get(groupName);
permissionGroup.setTagId(tagId);
updatePermissionGroup(permissionGroup);
}
Expand All @@ -648,10 +632,10 @@ public static void setTagID(String groupName, int tagId)
*/
public PermissionGroup createPermissionGroup(String permissionGroupName)
{
PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
final PermissionPool permissionPool = CloudAPI.getInstance().getPermissionPool();
if (!permissionPool.getGroups().containsKey(permissionGroupName))
{
PermissionGroup permissionGroup = new DefaultPermissionGroup(permissionGroupName);
final PermissionGroup permissionGroup = new DefaultPermissionGroup(permissionGroupName);
CloudAPI.getInstance().updatePermissionGroup(permissionGroup);
return permissionGroup;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,7 @@ public boolean accept(INetworkComponent networkComponent)

public NetworkManager sendAll(Packet packet, ChannelFilter filter)
{
this.executorService.submit(new Runnable() {
@Override
public void run()
{
this.executorService.submit(() -> {
for (Wrapper cn : CloudNet.getInstance().getWrappers().values())
{
if (cn.getChannel() != null && filter.accept(cn))
Expand All @@ -371,9 +368,7 @@ public void run()
if (cloudServer.getChannel() != null && filter.accept(cloudServer))
cloudServer.sendPacket(packet);

}
}
});
}});
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@
import de.dytanic.cloudnetcore.api.event.server.ScreenInfoEvent;
import de.dytanic.cloudnetcore.network.components.INetworkComponent;

import java.lang.reflect.Type;
import java.util.Collection;

public class PacketInSendScreenLine extends PacketInHandler {
public final class PacketInSendScreenLine extends PacketInHandler {

private static final Type TYPE = new TypeToken<Collection<ScreenInfo>>() {
}.getType();

@Override
public void handleInput(Document data, PacketSender packetSender)
{
Collection<ScreenInfo> screenInfos = data.getObject("screenInfo", new TypeToken<Collection<ScreenInfo>>() {
}.getType());
Collection<ScreenInfo> screenInfos = data.getObject("screenInfo", TYPE);
CloudNet.getInstance().getEventManager().callEvent(new ScreenInfoEvent(screenInfos));

for (ScreenInfo screenInfo : screenInfos)
{
if (CloudNet.getInstance().getScreenProvider().getMainServiceId() != null && screenInfo.getServiceId().getServerId().equalsIgnoreCase(CloudNet.getInstance().getScreenProvider().getMainServiceId().getServerId()))
if (CloudNet.getInstance().getScreenProvider().getMainServiceId() != null &&
screenInfo.getServiceId().getServerId().equalsIgnoreCase(CloudNet.getInstance().getScreenProvider().getMainServiceId().getServerId()))
System.out.println("[" + screenInfo.getServiceId().getServerId() + "] " + screenInfo.getLine());
}

Expand Down
Loading

0 comments on commit 94be7cd

Please sign in to comment.