forked from lokka30/PhantomWorlds
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add access/deny permissions for worlds.
- Loading branch information
1 parent
301d3cc
commit dacdad0
Showing
10 changed files
with
74 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
.../lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/GameRulesResolver.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 0 additions & 55 deletions
55
src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/utils/WorldRule.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerTeleportListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package me.lokka30.phantomworlds.listeners.player; | ||
/* | ||
* Phantom Worlds | ||
* Copyright (C) 2023 Daniel "creatorfromhell" Vidmar | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import me.lokka30.phantomworlds.PhantomWorlds; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerPortalEvent; | ||
import org.bukkit.event.player.PlayerTeleportEvent; | ||
|
||
/** | ||
* PlayerTeleportEvent | ||
* | ||
* @author creatorfromhell | ||
* @since 2.0.5.0 | ||
*/ | ||
public class PlayerTeleportListener implements Listener { | ||
|
||
final PhantomWorlds plugin; | ||
|
||
public PlayerTeleportListener(PhantomWorlds plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@EventHandler | ||
public void onPortal(PlayerTeleportEvent event) { | ||
if(event.getTo() == null || event.getTo().getWorld() == null || event.getFrom().getWorld() == null) { | ||
return; | ||
} | ||
|
||
if(event.getFrom().getWorld().getUID().equals(event.getTo().getWorld().getUID())) { | ||
return; | ||
} | ||
|
||
final String cfgPath = "worlds-to-load." + event.getTo().getWorld().getName(); | ||
|
||
if(PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + ".whitelist", false) | ||
&& !event.getPlayer().hasPermission("phantomworlds.world.access." + event.getPlayer().getWorld())) { | ||
event.setCancelled(true); | ||
return; | ||
} | ||
|
||
if(event.getPlayer().hasPermission("phantomworlds.world.deny." + event.getPlayer().getWorld())) { | ||
event.setCancelled(true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 0 additions & 56 deletions
56
src/main/java/me/lokka30/phantomworlds/managers/WorldRule.java
This file was deleted.
Oops, something went wrong.